Re: bash question

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

 



Ooops!
must be a bash script...
sorry

Joao Victor A. Di Stasi wrote:

/usr/bin/seq 1 2 10
works fine

Scott@Charter wrote:

I can't get this bash script to work. It's suppose to print all odd numbers
from 1 to 10.


#!/usr/bin/bash

LIMIT=10
a=1

while [ "$a" -le $LIMIT ]
do
 if [ "$a" -eq $(1 3 5 7 9) ]     <---------Something not right here.
   then
     echo -n "$a "
   fi

echo

let "a+=1"
done
echo; echo
exit 0


Can anyone figure out what I am doing wrong? Can I also see the same thing
written in Perl?


Thanks for your help.



Scott D. Smallsreed
3030 Chipmunk Dr.
Washoe Valley, NV 89704
775.849.8411 Hm
775.849.8412 Fax
775.722.7773 Cell



- : send the line "unsubscribe linux-admin" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html


- : send the line "unsubscribe linux-admin" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Newbie]     [Audio]     [Hams]     [Kernel Newbies]     [Util Linux NG]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Device Drivers]     [Samba]     [Video 4 Linux]     [Git]     [Fedora Users]

  Powered by Linux