All tricks in this blog are only for educational purpose. Learn these tricks only for your knowledge. Please donot try these to harm any one. We will not take any responsibility in any case. All softwares and tools on this site are here for private purposes only and If you want to use a software for business purpose, please purchase it. I do not host many of these tools. I Post links that I have found from numerous Search engines. I will not be responsible for any of harm you will do by using these tools.


Thursday, September 23, 2010

40. Shell Scripts

shell bash shell scripts shell if-then-else…shell script info bashbashshellhttp://www.oreilly.com.tw/chinese/linux/learn_bashshell.html 40.1. bash shell scripts keywords shell \n shell shell script 40.2. variable $ MYNAME=”smith ” Shell Scripts $ MYAGE=35$ echo $MYNAME $MYAGEs mith 35 shell $ NUMBER=”10″$ expr $NUMBER + 5+15 shell script shellscript $ FILENAME=”My Document”$ ls $FILENAMEls: My: No such file or directory lsls:

Document: No such file or directory$ ls -l “$FILENAME”My Documentls$ HAT=”fedora”$ echo “The plural of $HAT is $HATs”The plural of fedora is HATs$ echo “The plural of $HAT is ${HAT}s”The plural of fedora is fedoras 40.3. Scriptechoprintf17434. $ echo “Hello world”Hello world$ printf “I am %d years old\n” `expr 20 + 20`I am 40 years old Shell script readstdin $ read name Sandy Smith$ echo “I read the name $name”I read the name Sandy Smith 40.4. Boolean testtruefalseshell0Linuxshellreturn value exit status$? $ cat myfile My name is Sandy Smith andI really like Fedora Linux$ grep Smith myfileMy name is Sandy Smith and$ echo $?0$ grep aardvark myfile$ echo $?1 Linuxmanpage0LinuxPOSIX test[ bash shelltesttest01 Enter Shell Scripts $ test 10 -lt 510 < f2f1f2s1 =" s2s1">

Download 40. Shell Scripts.


Post a Comment