[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

RE: IF statements on the command line in bash



> $ for i in 21 22 23 24 25 26 27 28 29 30 ; echo "Sep $i" ; done

for i in 1 2 3 ; do echo "i is $i" ; done

> $ if [ -x /etc/hosts ] ; echo "File exists." ; done

I doubt you are trying to do the above as -x tests if the files is
eXecutable -e tests for existence.

if [ -e /etc/hosts ] ; then echo "File exists." ; fi


HTH,
Chad





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]