The file can have different number of other files names or nothing
I will check
cnt=`wc -l file_name_0.txt`
if [ "cnt" -eq "0" ];then
exit 1
fi
Now I have to start checking file names, i.e. read txt file line by line. If amount of ,lines equal 1, I can do it
Otherwise I think I have to put it in for loop
How can I do it? while (1) is not working.
I don't know if ksh support for loop
Hi digioleg54,
I have no idea what you mean by "The last loop doesn't support KSH." Any POSIX shell and any shell based on Bourne shell syntax does support the while loop MadeInGermany suggested:
while read line
do
echo "do somthing with $line"
done < file_name_0.txt
And, it is much more efficient and more likely to work than the loop you suggested above. Your has to start up another shell for the command substitution, run the cat utility to get the contents of file_name_0.txt , and will not work correctly if any filename contained in file_name_0.txt contains any IFS characters (by default, including <space> and <tab>). The code MadeInGermany works correctly in this case while your code does not.
While it is true that the code MadeInGermany suggested will not with if you are using csh or one of its derivatives, the code you suggested will not work with those shells either.