23 lines
488 B
Bash
23 lines
488 B
Bash
|
|
#!/usr/bin/env bash
|
||
|
|
|
||
|
|
#-------------------------------------------------------------------------------
|
||
|
|
# Example 4 for Bash Tips show 21: a way of showing environment variables
|
||
|
|
#-------------------------------------------------------------------------------
|
||
|
|
|
||
|
|
#
|
||
|
|
# We expect one or more arguments
|
||
|
|
#
|
||
|
|
if [[ $# = 0 ]]; then
|
||
|
|
echo "Usage: $0 variable_name"
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
|
||
|
|
#
|
||
|
|
# Loop through the arguments reporting their attributes with 'declare'
|
||
|
|
#
|
||
|
|
for arg; do
|
||
|
|
declare -p "$arg"
|
||
|
|
done
|
||
|
|
|
||
|
|
exit
|