Hi ,
I need to replace the file name extension with txt to csv,i wrote the below script when executing its giving the below error.Please anyone how to do this?
$ a2.sh
mv: *.: cannot access: No such file or directory
./a2.sh[7]: o: bad number
$ vi a2.sh
a2.sh
-----
#!/bin/ksh
txt=$1
csv=$2
for file in *.$txt ; do
mv $file ${file%$txt}$csv
done
exit o
ur script looks wrong...
for loop expects a list for action.
"for file in *.$txt" means what???
if u are providing list as the 1st argument ( as u wrote in ur code) than why u are not supplying list when executing the script.
if u want to do with all the file in the current dir use
for file in `/bin/ls *.txt`