Presentation is loading. Please wait.

Presentation is loading. Please wait.

Shell Programming Oleh: Idris Winarno. Topik Hello world!!! Variables Functions Conditionals Loops Function.

Similar presentations


Presentation on theme: "Shell Programming Oleh: Idris Winarno. Topik Hello world!!! Variables Functions Conditionals Loops Function."— Presentation transcript:

1 Shell Programming Oleh: Idris Winarno

2 Topik Hello world!!! Variables Functions Conditionals Loops Function

3 Percobaan 1 # vi coba1.sh #!/bin/bash echo “Hello world” #chmod u+x./coba1.sh./coba1.sh

4 Percobaan 2 # vi coba2.sh #!/bin/bash pwd ls -l date # chmod u+x./coba2.sh./coba2.sh Bandingkan dengan: # pwd; ls -l; date

5 Percobaan 3 # vi coba3.sh # !/bin/bash var1=“Hello world” var2=`ls` echo $var1 echo $var2 # chmod u+x./coba3.sh #./coba3.sh

6 Percobaan 4 vi coba4.sh #!/bin/bash HELLO=Hello function hello { local HELLO=World echo $HELLO } echo $HELLO hello echo $HELLO # chmod u+x./coba4.sh #./coba4.sh

7 Percobaan 5 # vi coba5.sh #!/bin/bash if [ "foo" = "foo" ]; then echo expression evaluated as true fi # chmod u+x./coba5.sh./coba5.sh

8 Percobaan 6 # vi coba6.sh #!/bin/bash T1="foo" T2="bar" if [ "$T1" = "$T2" ]; then echo expression evaluated as true else echo expression evaluated as false fi # chmod u+x./coba6.sh./coba6.sh

9 Percobaan 7 vi coba7.sh #!/bin/bash for i in $( ls ); do echo item: $i done # chmod u+x./coba7.sh./coba7.sh

10 Percobaan 8 vi coba8.sh #!/bin/bash COUNTER=0 while [ $COUNTER -lt 10 ]; do echo The counter is $COUNTER let COUNTER=COUNTER+1 done # chmod u+x./coba8.sh./coba8.sh

11 Percobaan 9 # vi coba9.sh #!/bin/bash function quit { exit } function hello { echo Hello! } hello quit echo foo # chmod u+x./coba9.sh #./coba9

12 Percobaan 10 # vi coba10.sh #!/bin/bash function quit { exit } function e { echo $1 } e Hello e World quit echo foo # chmod u+x./coba10.sh./coba10.sh


Download ppt "Shell Programming Oleh: Idris Winarno. Topik Hello world!!! Variables Functions Conditionals Loops Function."

Similar presentations


Ads by Google