Actually my final goal is to list out all the .txt files inside ../dat/fpgatst/ and show me only the file name inside that with no extension name ..
Example:
if there is file called LVDS.txt. Then it should display me only the file name ,ie, LVDS
Now I am doing a simple shell script like below
#!/usr/bin/ksh -f
ch=$1
if [ $# -lt 1 ];then
echo "USAGE: $0 testname"
echo " [Options]"
echo " ls : list all available CSV files"
exit 1
fi
case $ch in
ls) echo ""
echo "====Available CSV files===="
ls ../dat/fpgatst/*.txt
exit 1
;;
esac
It displays
../dat/fpgatst/\*.txt: No such file or directory
if I am trying only
ls ../dat/fpgatst/
Then its working properly..But I when I put *.txt at end . it throws me the above error
I tried also
ls '../dat/fpgatst/*.txt'
. It displays me
../dat/fpgatst/*.txt: No such file or directory
And one more thing when I remove -f option from my first line of the programme It seems to be working fine .
I cant even guess what is happening ? Please give me some tips on this ..
I don't use ksh but my guess is that when ls cannot find any *.txt files then the ls command exits with a return value greater than zero and if zsh -f is the same as set -e in bash then the script will silently exit at that point. You can get rid of the ls error output with something like "2>/dev/null".