Skip to content

Instantly share code, notes, and snippets.

@ilkayisik
Last active July 14, 2019 18:19
Show Gist options
  • Save ilkayisik/f54e80d1c06d1845cf675026104da14d to your computer and use it in GitHub Desktop.
Save ilkayisik/f54e80d1c06d1845cf675026104da14d to your computer and use it in GitHub Desktop.
var="hello/my/name/is"
# everything after the first slash:
echo "${var#*/}"
# everything after the last slash:
echo "${var##*/}"
# everything before the first slash:
echo "${var%%/*}"
#everything before the last slash:
echo "${var%/*}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment