31.10.2016 Views

Shell Scripts

week5_loops

week5_loops

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

31-Oct-16<br />

The For Loop Cont’d<br />

#!/bin/sh<br />

OUTPUT<br />

for FILE in $HOME/.bash*<br />

do<br />

echo $FILE<br />

done<br />

/root/.bash_history<br />

/root/.bash_logout<br />

/root/.bash_profile<br />

/root/.bashrc<br />

The For Loop Cont’d<br />

SYNTAX<br />

for (( expr1; expr2; expr3 ))<br />

do<br />

done<br />

.....<br />

.....<br />

repeat all statements between do and<br />

done until expr2 is TRUE<br />

#!/bin/sh<br />

for (( i = 0 ; i

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!