LDP/LDP/guide/docbook/abs-guide/ex34.sh

36 lines
812 B
Bash
Raw Normal View History

2001-07-10 14:25:50 +00:00
#!/bin/bash
2008-11-23 22:43:47 +00:00
# ex34.sh
# Script "set-test"
2001-07-10 14:25:50 +00:00
2008-11-23 22:43:47 +00:00
# Invoke this script with three command-line parameters,
# for example, "sh ex34.sh one two three".
2001-07-10 14:25:50 +00:00
echo
echo "Positional parameters before set \`uname -a\` :"
echo "Command-line argument #1 = $1"
echo "Command-line argument #2 = $2"
echo "Command-line argument #3 = $3"
2001-09-04 13:27:31 +00:00
set `uname -a` # Sets the positional parameters to the output
# of the command `uname -a`
2001-07-10 14:25:50 +00:00
2008-11-23 22:43:47 +00:00
echo
echo +++++
echo $_ # +++++
2002-07-22 15:11:51 +00:00
# Flags set in script.
2008-11-23 22:43:47 +00:00
echo $- # hB
# Anomalous behavior?
echo
2002-07-22 15:11:51 +00:00
2001-07-10 14:25:50 +00:00
echo "Positional parameters after set \`uname -a\` :"
# $1, $2, $3, etc. reinitialized to result of `uname -a`
echo "Field #1 of 'uname -a' = $1"
echo "Field #2 of 'uname -a' = $2"
echo "Field #3 of 'uname -a' = $3"
2008-11-23 22:43:47 +00:00
echo \#\#\#
echo $_ # ###
2001-07-10 14:25:50 +00:00
echo
exit 0