ep0531 :: bash loops

Hosted by Ken Fallon on 2010-03-24
Filed under Episode | Comments (0)

user@pc:~$ for number in 1 2 3
> do
> echo my number is $number
> done
my number is 1
my number is 2
my number is 3

user@pc:~$ for number in 1 2 3 ; do echo my number is $number; done
my number is 1
my number is 2
my number is 3

user@pc:~$ cat x.txt|while read line;do echo $line;done
one-long-line-with-no-spaces
one ling line with spaces

user@pc:~$ for line in `cat x.txt`;do echo $line;done
one<-long-line-with-no-spaces
one
ling
line
with
spaces


Comment Script

Post this page to: del.icio.us Yahoo! MyWeb Digg reddit Furl Blinklist Spurl

Name
E-mail (Will not appear online)
Website
Title
Comment
To prevent automated Bots form spamming, please enter the text you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.



Powered by Comment Script











linkboxes

Affiliates:


Hosting for HPR is provided by...








l