ammu
1
I am new to scripting.
I am using the following script . BART.dat contains the string 'Y' .
#!/bin/ksh
cd /work/TCI/data_out
file=`cat BART.dat`
echo "$file"
if ["$file"=="Y"]; then
echo "true"
fi
When i am executing the above script i am getting the following error
./s.ksh[6]: [Y==Y]: not found
What could be the problem.
Thanks in advance
Dhruva
2
i dont know but this line should be checked
replace
if ["$file"=="Y"];
by
if [ "$file" = "Y" ];
Please note space after [ and before ] and =
aigles
3
The operator for equality test is = not ==
With ksh you can read a file into a variable with the $(<file) syntax
#!/bin/ksh
cd /work/TCI/data_out
file=$(<BART.dat)
echo "$file"
if [ "$file" = "Y" ]; then
echo "true"
fi
Jean-Pierre.