HPR: Bash Loops

I have been thinking about doing a small episode on bash loops for some time after I heard the guys at the The Linux Cranks discussing the topic. Well I found some time to record the show on my way to Ireland for the weekend. The show is recorded in a Airbus A320-200 !

OK so not the best audio quality but follows in the long history of linux podcasting

The show is available on the Hacker Public Radio website.

Here are the examples I used in the show.

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 long line with spaces

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

This entry was posted in Podcasts and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published.