Bash remove prefix from a string variable
Remove a leading string from a variable. The string after the number sign is removed from the variable.
$ mkdir -p /tmp/path/to/something/
$ cd /tmp/path/to/something/
$ echo $PWD
/tmp/path/to/something
$ echo "${PWD#/tmp}"
/path/to/something
Comments
Leave a Reply