Shell(bash) Scripting

  • View
    1.123

  • Download
    1

Embed Size (px)

Text of Shell(bash) Scripting

  • 1.

2. 1. Ws shell?Y shell? (KEY point)2. Basic usage of Bash3. I/O Redirection4. Ws IFS?5. Special Characters6. Basic Syntax { for,if,case,while }7. Trap()8. Learn more... 3. Ws the fucking shell? 4. Ws the fucking shell? 5. Ws the fucking shell? Bourne shell Csh Tcsh Ksh Bash Ash Zsh Python shell Ruby shell 6. Ws the fucking shell? Shellloginnonloginshell non-login shell Login shell login/etc/passwd /etc/profile~/.bash_profileshell(rc) Non-login shell ~/.bashrc/bin/bash/bin/suxterm 7. Ws the fucking shell? shellforksubshellshellsourcesourceforkshellsource.: 8. Ws the fucking shell?shell alias function ($PATH) 9. Why shell script? (IT) sha-bangshell 10. 1. Ws shell?Y shell? (KEY point)2. Basic usage of Bash3. I/O Redirection4. Ws IFS?5. Special Characters6. Basic Syntax { for,if,case,while }7. Trap8. Learn more... 11. Basic usage of Bash CLI uniq,diff,paste,head,tail,wc,cat,cutexpand,fmt,join,nl,od,pr,sort,split,tr 12. Basic usage of Bash $PS1 $PS2 $HOME $PATH $IFS $HOST $LANG $LC_* 13. 1. Ws shell?Y shell? (KEY point)2. Basic usage of Bash3. I/O Redirection4. Ws IFS?5. Special Characters6. Basic Syntax { for,if,case,while }7. Trap8. Learn more... 14. I/O Redirection I/O stdin stdout stderr 0,1,2FD(File decriptor) 15. I/O Redirection I/OI/O 16. 1. Ws shell?Y shell? (KEY point)2. Basic usage of Bash3. I/O Redirection4. Ws IFS?5. Special Characters6. Basic Syntax { for,if,case,while }7. Trap8. Learn more... 17. Ws IFS? IFS-Internal Field Separator IFS IFSshellshell 18. 1. Ws shell?Y shell? (KEY point)2. Basic usage of Bash3. I/O Redirection4. Ws IFS?5. Special Characters6. Basic Syntax { for,if,case,while }7. Trap8. Learn more... 19. Special Characters --hard quote--soft quote 20. Special Characters$(( ))$( )${ } $( )`` () $(( ))$((1+2+3)) ${ } 21. Special Characters$*$@ $$#,$0,$1,$2 $* $@ 22. 23. Special Characters( ){ } ( ) command group sub-shell , nested sub-shell { } shell , non- named command group 24. 1. Ws shell?Y shell? (KEY point)2. Basic usage of Bash3. I/O Redirection4. Ws IFS?5. Special Characters6. Basic Syntax { for,if,case,while }7. Trap8. Learn more... 25. Basic Syntaxecho -e t,n -E -necho 26. Basic Syntax IFSshell pi = 3.14 export 27. Basic Syntaxsource exec source execsource fork 28. 29. Basic Syntax if 30. Basic Syntax for 31. Basic Syntax case 32. 1. Ws shell?Y shell? (KEY point)2. Basic usage of Bash3. I/O Redirection4. Ws IFS?5. Special Characters6. Basic Syntax { for,if,case,while }7. Trap8. Learn more... 33. Trap UNIX Trap singal signal signal 34. Learn More (BRE,ERE,PCRE) grep|egrep Sed/Awk find Perl | Python | Ruby Dialog (Red Hat) 35. Any Queries?