JupiterV2
June 13th, 2008, 05:59 PM
I get the following error with the code below:
Error:
./cd_app.sh: 1: Bad substitution
cut: you must specify a list of bytes, characters, or fields
Try `cut --help' for more information.
Error with debug flags:
+ [ 3 /tmp/cdb.7505 = 0 ]
+ echo
+ echo metallica :−
+ echo
+ cut −f 2− −d , /tmp/cdb.7505
./cd_app.sh: 1: Bad substitution
cut: you must specify a list of bytes, characters, or fields
Try `cut --help' for more information.
+ echo
+ set +vxu
Full function:
list_tracks() {
if [ "$cdcatnum" = "" ]; then
echo "no CD selected yet"
return
else
grep "^${cdcatnum}," $tracks_file > $temp_file
num_tracks=$(wc -l $temp_file)
set -vxu
if [ "$num_tracks" = "0" ]; then
echo "no tracks found for $cdtitle"
else {
echo
echo "$cdtitle :−"
echo
cut -f 2- -d , $temp_file
echo
} | ${PAGER:−more}
set +vxu
fi
fi
get_return
return
}
What I don't understand is why the code "cut -f 2- -d , $temp_file" works on the command line as intended but not from within the script! What am I doing wrong?
Error:
./cd_app.sh: 1: Bad substitution
cut: you must specify a list of bytes, characters, or fields
Try `cut --help' for more information.
Error with debug flags:
+ [ 3 /tmp/cdb.7505 = 0 ]
+ echo
+ echo metallica :−
+ echo
+ cut −f 2− −d , /tmp/cdb.7505
./cd_app.sh: 1: Bad substitution
cut: you must specify a list of bytes, characters, or fields
Try `cut --help' for more information.
+ echo
+ set +vxu
Full function:
list_tracks() {
if [ "$cdcatnum" = "" ]; then
echo "no CD selected yet"
return
else
grep "^${cdcatnum}," $tracks_file > $temp_file
num_tracks=$(wc -l $temp_file)
set -vxu
if [ "$num_tracks" = "0" ]; then
echo "no tracks found for $cdtitle"
else {
echo
echo "$cdtitle :−"
echo
cut -f 2- -d , $temp_file
echo
} | ${PAGER:−more}
set +vxu
fi
fi
get_return
return
}
What I don't understand is why the code "cut -f 2- -d , $temp_file" works on the command line as intended but not from within the script! What am I doing wrong?