Please use code tags as per forum rules for your commands/Inputs/codes into your posts.
Could you please try following and let me know if this helps you.
Input_file="/path/of/file/file_name"
Output_file="/output/file/path/output_file_name"
if [[ -f $Input_file ]]
then
echo "file found" >> $Output_file
else
echo "file not found" >> $Output_file
fi
I guess this is another reoccurrence of DOS line teminators <CR> (= \r, ^M, 0x0D) interfering with shell's keywords, e.g. then . How (i.e. with which editor) did you produce the script? Please post the output of
0000000 23 21 2f 62 69 6e 2f 62 61 73 68 0d 0a 23 20 3d
# ! / b i n / b a s h \r \n # =
0000020 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d
= = = = = = = = = = = = = = = =
0001315
Sorry for a late reply...ya I have tried the above quote and as I mentioned there was no use and about spaces b/w those square brackets, I tried it too but got more errors, so I restored the spaces and I believe it is the right WY to go about it as I found in numerous portals.
Just checked and 'vi' is part of the CygWin install, I thought it was 'vim', but type in 'vi' and voila up comes the editor...
Must be an 'alias' for the 'vim' executable.