I'm using this thread as an example, but can't seem to apply it to my situation.
I'm trying to strip the trailing slash (/) from an input argument. Here's a snippet of my command line input and the troublesome code:
$ script_name -s "../pathname/dir/"
snip 8< ...
while getopts :s: FLAGNAME
do
case $FLAGNAME in
s) start_dir=$OPTARG
start_dir=`echo "${start_dir}" | sed ` s/[^\/]\/+$ //``
echo $start_dir # should be ../pathname/dir
;;
h) echo "Wrong syntax"
exit 1
;;
done
I get an error s/[: not found