How to remove prefix from string in Bash?
For example:
STRING1="My name is James"
echo "${STRING1}"
# My name is James
NAME="${STRING1#???}"
echo "${NAME}"
# James
How to remove prefix from string in Bash?
For example:
STRING1="My name is James"
echo "${STRING1}"
# My name is James
NAME="${STRING1#???}"
echo "${NAME}"
# James
Alternative:
FOO=${FOO//$WORDTOREMOVE/}
Update as per @gniourf_gniourf's suggestion :
FOO=${FOO/#$WORDTOREMOVE/}