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

RE: IF statements on the command line in bash



Try this for the 1st one...
for i in 21 22 23 24 25 26 27 28 29 30 ; do echo "Sep $i" ; done

for the 2nd one...
if [ -x /etc/hosts ] ; then echo "File exists." ; fi

JMF
-----Original Message-----
From: Rodolfo J. Paiz [mailto:rpaiz indahaus com]
Sent: Monday, October 01, 2001 10:53 AM
To: redhat-list redhat com
Subject: 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



_______________________________________________
Redhat-list mailing list
Redhat-list redhat com
https://listman.redhat.com/mailman/listinfo/redhat-list





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