-
-
Save speed-of-light/6289742 to your computer and use it in GitHub Desktop.
shell string manipulation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function gcst(){ | |
| # $1: repo path | |
| # $2: tag-name | |
| git clone $1 | |
| cd ${$1%%.*} | |
| git tag -l | |
| git checkout $2 | |
| git branch -D master | |
| git checkout -b master | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Given: | |
| foo=/tmp/my.dir/filename.tar.gz | |
| We can use these expressions: | |
| path = ${foo%/*} | |
| To get: /tmp/my.dir (like dirname) | |
| file = ${foo##*/} | |
| To get: filename.tar.gz (like basename) | |
| base = ${file%%.*} | |
| To get: filename | |
| ext = ${file#*.} | |
| To get: tar.gz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment