Live Chat!

if … then … fi

3 votos Vota!!

October 13th, 2006 mysurface

if iis a basic programming checking for condition and reacts based on the condition, bash uses if to check for

File
integer
String

For checking the File, let say your file name is stored at $fn, and you wanna check the file is exist ? do this:

if [ -e $fn ]
then
echo “$fn exist.”
else
echo “$fn does not exist.”
fi
Bellow are [...]

Posted in Bash, Misc, echo, if | Hits: 24134 | 1 Comment »