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

IF statements on the command line in bash



From the "I must have missed something" department:

I often find myself needing to do simple, short if's or for's from the command line. However, I can't seem to get the hang of it. As an example, these two don't work:

$ for i in 21 22 23 24 25 26 27 28 29 30 ; echo "Sep $i" ; done
$ if [ -x /etc/hosts ] ; echo "File exists." ; done

Can't find what's wrong from the man page; is it that you can't do this from the CLI, or am I doing something wrong?


-- Rodolfo J. Paiz rpaiz indahaus com





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