Home > Programming > Shell Programming



Shell scripting

Sort Desciption:

process id of last background process. $$. process id of shell running this script. $. the current shell flags .... BASH Programming Introduction HOWTO: ...



Content Inside:

Shell scriptingPage 1Shell scriptingThursday March 16th 2006Page 2What is Shell?An command language interpreterCommands read and executed from the standard input device(keyboard) or from a (plain text) fileSeveral shells available with Linux including BASH CSH TCSHPage 3hello_world.sh#!/bin/bashecho Hello Worldchmod +x hello_world.shorchmod 755 hello_world.sh./hello_world.shPage 4VariablesSystem variablesUser created variablesNo data typesNo declarationCan contain (almost) anythingPage 5Variables namingName must start with Alphanumeric character or underscorecharacterCasesensitiveNo spaces on either side of the equal signPage 6Variables examplesSTR=Hello WorldDEST_FOLDER=/home/bajazid/data/DEST_F OLDER=/home/bajazid/data/MY_NUMBER=22SUM=$ MY_NUMBER + 1NEW_FILE=test + $SUM #ERROR1_number=3 #ERROR_number1=3Page 7Special variables$?exit status or return code of last command$#number of arguments$@argument 1 thru n with Input Field Separator$*"$1" $2" ... $n$!process id of last background process$$process id of shell running this script$the current shell flagsPage 8readcommandRead variables from command lineecho File name: read FILE_NAMEtouch ${FILE_NAME}.datPage 9Escape charactersUse backslash to escape special charactersExample:echo Hallo BCCSPage 10testcommandUsed to test expression given toifstatementtest expressionor expression ]Three types of expressions File tests String comparisons Numerical comparisonsPage 11Theifstatementif expression1 ]thenecho expression1 is trueelif expression2 ]thenecho expression2 is trueelseecho all other casesfiPage 12File teststest option fileor option file ]Exampleif d /Home/bccs/bajazid/bin ] ; thenPATH="$PATH:/Home/bccs/bajazid/bi nfiPage 13File tests optionsd fileTrue if file exists and is a directory.e fileTrue if file exists.f fileTrue if file exists and is a regular file.h fileTrue if file exists and is a symbolic link.r fileTrue if file exists and is readable.s fileTrue if file exists and has a size gr ...

Source: www.parallab.uib.no


add to Google Reader add to Google Bookmark add to bloglines add to newsgator add to FURL add to digg add to webnews add to Netscape add to Yahoo MyWeb add to spurl.net add to diigo Bookmark newsvine Bookmark del.icio.us Bookmark @ SIMPIFY Bookmark MISTER WONG Bookmark Linkarena Bookmark icio.de Bookmark oneview Bookmark folkd.com Bookmark yigg.de Bookmark reddit Bookmark StumbleUpon Bookmark Slashdot Bookmark blinklist Bookmark technorati add to blogmarks add to blinkbits add to ma.gnolia add to smarking.com add to netvouz add to co.mments add to Connotea add to de.lirio.us
Search Terms:

 

Related Files

basic shell programming

Filed under: Programming and Shell Programming
bash derives much of its programming functionality from shell variables. Weve ... builtin variables that are vital to shell programming. ...

Unix Shell Scripts

Filed under: Programming and Shell Programming
that file is called shell script language. Like other programming languages it has variables and flow control. statements (e.g. ifthenelse while for ...

UNIX Shell Programming

Filed under: Programming and Shell Programming
Page 1 of 1 ITC_UNIXsp ExecuTrain Course Outline UNIX Shell Programming IT0001 3 Days Description Students learn to read, write, and debug shell scripts, thus increasing ...

Automated testing using Shell Scripting

Filed under: Programming and Shell Programming
Advanced Bash scripting guide from The Linux Documentation Project (TLDP). Unix Shell Programming by Yashavant Kanetkar BPB Publication. ...

Shell Programming

Filed under: Programming and Shell Programming
This training in Shell Programming is designed for. administrator to create and debug shell scripts so as to. automate routine tasks. ...