22 lines
614 B
Bash
22 lines
614 B
Bash
#!/bin/bash -e
|
|
|
|
#####################################################
|
|
#
|
|
# Arguments are provided to commands and scripts usually
|
|
# separated by a space. They can be read and used within
|
|
# bash scripts by referencing them with the "$#" notation.
|
|
#
|
|
# Usage: bash bash/arguments.sh <first> <second> <third> <etc>
|
|
#
|
|
#####################################################
|
|
|
|
echo "You entered \"$1\" as the first argument"
|
|
|
|
# Using a slightly different notation
|
|
if [ "${2}" != "" ]; then
|
|
echo "You entered \"${2}\" as the second argument"
|
|
fi
|
|
|
|
if [ "${3}" != "" ]; then
|
|
echo "All of the arguments you entered \"${@}\""
|
|
fi |