Shell Programming Oleh Idris Winarno Shell dan Shell














- Slides: 14

Shell Programming Oleh: Idris Winarno

Shell dan Shell Programming n n n Shell adalah Command executive, artinya program yang menunggu instruksi dari pemakai, memeriksa sintak dari instruksi yang diberikan, kemudian mengeksekusi perintah tersebut. Dengan Shell Programming memungkinkan menjalankan comand secara otomatis Shell ditandai dengan prompt. Untuk pemakai menggunakan prompt $ dan untuk superuser menggunakan promp #.

Tipe Shell n n Beberapa macam shell : /bin/sh q n /bin/csh q n Bourne shell, dirancang oleh Steve Bourne dari AT&T Dikembangkan oleh UNIX Berkeley yang dikenal dengan C-Shell /bin/bash q Kompatibel dengan Bourne Shell dan juga mengadaptasi kemampuan Korn- Shell.

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

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

Percobaan 3 n n # vi coba 3. sh # !/bin/bash var 1=“Hello world” var 2=`ls` echo $var 1 echo $var 2 n n # chmod u+x. /coba 3. sh #. /coba 3. sh

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

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

Percobaan 6 n n # vi coba 6. sh #!/bin/bash T 1="foo" T 2="bar" if [ "$T 1" = "$T 2" ]; then echo expression evaluated as true else echo expression evaluated as false fi n n # chmod u+x. /coba 6. sh

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

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

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

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

Percobaan 11 n Menampilkan long list dari file yang mempunyai ekstensi lst $ vi for 11. sh #!/bin/bash for F in *. * do ls –l $F done n n # chmod u+x. /for 11. sh
Idris winarno
Idris winarno
Idris winarno
Shell cleanliness shell soundness shell texture shell shape
Shell cleanliness shell soundness shell
Tegese tembung aywa lali
Trachette jackson
Testimonial definition literature
Idris ali salam
Dr mona idris
Dennis kozlowski tyco
Perbedaan linear programming dan integer programming
Definisi integer
Switch case in unix
Greedy vs dynamic programming