5. www.exoplatform.com Copyright 2011 eXo Platform What is shell ? Popular Shells Shell Name Developed by Where Remark BASH ( Bourne-Again SHell ) Brian Fox and Chet Ramey Free Software Foundation Most common shell in Linux. It's Freeware shell. CSH (C SHell) Bill Joy University of California (For BSD The C shell's syntax and usage are very similar to the C programming language. KSH (Korn SHell) David Korn AT & T Bell Labs TCSH See the man page. Type $ man tcsh TCSH is an enhanced but completely compatible version of the Berkeley UNIX C shell (CSH).
9. www.exoplatform.com Copyright 2011 eXo Platform How to use Shell ? - To use shell (You start to use your shell as soon as you log into your system) you have to simply type commands. - See common Linux Command for syntax and example, this can be used as quick reference while programming the shell.
10. www.exoplatform.com Copyright 2011 eXo Platform What is Shell Script ? Normally shells are interactive. It means shell accept command from you (via keyboard) and execute them. But if you use command one by one (sequence of 'n' number of commands) , the you can store this sequence of command to text file and tell the shell to execute this text file instead of entering the commands. This is know as shell script.
11. www.exoplatform.com Copyright 2011 eXo Platform What is Shell Script ? Why to Write Shell Script ? Shell script can take input from user, file and output them on screen. Useful to create our own commands. Save lots of time. To automate some task of day today life. System Administration part can be also automated.
12.
13.
14. www.exoplatform.com Copyright 2011 eXo Platform Shell Scripting Manual -Parameters + It is their position on the command line - Operators Operators Example if... else if [ $a == $b ]; then .... fi if [ $a == $b ]; then .... elif [ $a == "xxx" ]; then ... fi if [ $a == $b ]; then .... elif [ $a == "xxx" ]; then ... else ... fi For Loops for X in `ls *.java` do .... done for ((i = 0 ; i <= 10 ; i++ )) do ... done Functions function abc { .... do something ... } Parameters Detail $0 Name of the calling program $1 - $9 Command-line Arguments
15. www.exoplatform.com Copyright 2011 eXo Platform Shell Scripting Manual - Parameters + Value of Command-line arguments: $* and $@( not just the first nine) “ $*” : treats the entire list of arguments as a single argument “ $@” : produce a list of separate arguments (Only bash/ksh/sh) + Example for use: - Array + Initialization: arr=(item1 item2 item3 ... itemn). + Use: echo arr[0]; + Loops: for X in "${arr[@]}"; do ... done
18. www.exoplatform.com Copyright 2011 eXo Platform Exo Shell Scripting II. Apply shell for Exo - Create stack for build projects (exobuild). - Create alias for quick run command. - Create function for run sequential other command. - Setup or install other application help for work in eXo - Create function for automatically run some stack (ex: jenkins) - Create function (search by rules) for checking bug in code. - Maybe we can use find/grep/sed for fix some bug :D. (ex: accessibility )
19. www.exoplatform.com Copyright 2011 eXo Platform Exo Shell Scripting III. EXOCT (my shell scripting for eXo) - Quick use some function in eXo. - Quick goto produce. - Easy for update/build other produces - Easy for create patch - Easy for build quickwar/module of produce - Easy for run tomcat ... Other..
20. www.exoplatform.com Copyright 2011 eXo Platform Document reference 1/ The book attachment in wiki page. 2/ Link: http://javarevisited.blogspot.com http://tldp.org/LDP/abs/html/ http://www.freeos.com/guides/lsst/ (main) http://www.grymoire.com/Unix/Sed.html