Skip to content

Instantly share code, notes, and snippets.

@haoliplus
Created March 14, 2016 02:27
Show Gist options
  • Save haoliplus/1df537440861d94dc712 to your computer and use it in GitHub Desktop.
Save haoliplus/1df537440861d94dc712 to your computer and use it in GitHub Desktop.
cut str using shell ${}
var=/path/to/file.tar.gz
${var##*/} # file.tar.gz
${var##*.} # gz
${var#*.} # tar.gz
${var%/*} # /path/to
${var%%.*} #path/to/file.tar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment