9. Other Common Shells
C Shell (/bin/csh)
Turbo C Shell (/bin/tcsh)
Korn Shell (/bin/ksh)
10. An aside: What do I mean by /bin ?
C Shell (/bin/csh)
Turbo C Shell (/bin/tcsh)
Korn Shell (/bin/ksh)
11. An aside: What do I mean by /bin ?
/bin, /usr/bin, /usr/local/bin
/sbin, /usr/sbin, /usr/local/sbin
/tmp
/dev
/home/borwicjh
12. What is a Shell Script?
A Text File
With Instructions
Executable
13. What is a Shell Script?
% cat > hello.sh <<MY_PROGRAM
#!/bin/sh
echo ‘Hello, world’
MY_PROGRAM
% chmod +x hello.sh
% ./hello.sh
Hello, world
14. What is a Shell Script? A Text File
% cat > hello.sh <<MY_PROGRAM
#!/bin/sh
echo ‘Hello, world’
MY_PROGRAM
% chmod +x hello.sh
% ./hello.sh
Hello, world
16. What is a Shell Script? How To Run
% cat > hello.sh <<MY_PROGRAM
#!/bin/sh
echo ‘Hello, world’
MY_PROGRAM
% chmod +x hello.sh
% ./hello.sh
Hello, world
17. What is a Shell Script? What To Do
% cat > hello.sh <<MY_PROGRAM
#!/bin/sh
echo ‘Hello, world’
MY_PROGRAM
% chmod +x hello.sh
% ./hello.sh
Hello, world
18. What is a Shell Script? Executable
% cat > hello.sh <<MY_PROGRAM
#!/bin/sh
echo ‘Hello, world’
MY_PROGRAM
% chmod +x hello.sh
% ./hello.sh
Hello, world
19. What is a Shell Script? Running it
% cat > hello.sh <<MY_PROGRAM
#!/bin/sh
echo ‘Hello, world’
MY_PROGRAM
% chmod +x hello.sh
% ./hello.sh
Hello, world
20. Finding the program: PATH
% ./hello.sh
echo vs. /usr/bin/echo
% echo $PATH
/bin:/usr/bin:/usr/local/bin:
/home/borwicjh/bin
% which echo
/usr/bin/echo
21. Variables and the Environment
% hello.sh
bash: hello.sh: Command not found
% PATH=“$PATH:.”
% hello.sh
Hello, world
25. How to Learn
man
man bash
man cat
man man
man –k
man –k manual
Learning the Bash Shell, 2nd
Ed.
“Bash Reference” Cards
http://www.tldp.org/LDP/abs/html/
66. sqlplus
sqlplus $USER/$PASS @$FILE_SQL
$ARG1 $ARG2 $ARG3
if [ $? –ne 0 ]
then
exit 1
fi
if [ -e /file/sql/should/create ]
then
[…use SQL-created file…]
fi
Ask Amy Lamy!
67. Passing Arguments
% cat > test.sh <<_TEST_
echo “Your name is $1 $2”
_TEST_
% chmod +x test.sh
% ./test.sh John Borwick ignore-
this
Your name is John Borwick
68. INB Job Submission Template
$1: user ID
$2: password
$3: one-up number
$4: process name
$5: printer name
% /path/to/your/script $UI $PW
$ONE_UP $JOB $PRNT