Hello,
Why is this not working in a script?
files="test.fsa"
echo $files
for file in $files
do
if [ ! -e "$file" ]
then
echo "$file does not exist."
fi
run a command
done
I get an error saying
Did you edit this script in Microsoft Notepad? That will fill the file with useless carriage returns that will confuse the shell in many ways.
---------- Post updated at 09:49 AM ---------- Previous update was at 09:48 AM ----------
If "test.fsa" is a list of files, you should be doing this:
while read file
do
...
done < test.fsa
No I wrote it with vi editor. I have no idea what's going on. I also tried this (the entire script):
#!/bin/sh
#
#$ -pe threaded 20
#$ -l mem_free=50G
#$ -cwd
for i in *.txt
do
if [ -f $i ]
then
echo "$i exists, proceeding with description generator..."
else
echo "there is an error processing $i ... check it."
fi
./f1 $i ./description-tables/$i-output 10 30 40 DATA
done
I received an error message saying:
What's going on here?