I am using ubuntu, and I am writing a bash script. I am quite new to linux, and this is my first real script.
This script will run from the context menu in nautilus. I get the path of the current directory in the variable $NAUTILUS_SCRIPT_CURRENT_URI, and I need to strip off the last folder name. I use:
Code:
folder1=`basename "$NAUTILUS_SCRIPT_CURRENT_URI"`
or
Code:
folder1="${NAUTILUS_SCRIPT_CURRENT_URI##*/}"
and these work, so that if:
Code:
$NAUTILUS_SCRIPT_CURRENT_URI = home/this/that
then
...but if there are any spaces in the last folder, they show up as %20. How do I 'unescape' the spaces? I have tried:
Code:
folder2 = ${folder1//%20/\ }
But no dice. Any suggestions?