I need help to translate this line is from bash script
VARIABLE="${VARIABLE:: -3}"
this is from a script from linux, thx
CodePudding user response:
It's to make a substring with start and length ( ) or from end (-) position
echo ${foo}
abcdefg
# cut off the first and last character
echo ${foo:1:-1}
bcdef
# cut off the last 3 characters. start is empty
echo ${foo::-3}
abcd