mirror of https://github.com/tLDP/LDP
26 lines
782 B
Bash
26 lines
782 B
Bash
#!/bin/bash
|
|
# Note that this example must be invoked with bash, i.e., bash ex38.sh
|
|
#+ not sh ex38.sh !
|
|
|
|
. data-file # Load a data file.
|
|
# Same effect as "source data-file", but more portable.
|
|
|
|
# The file "data-file" must be present in current working directory,
|
|
#+ since it is referred to by its basename.
|
|
|
|
# Now, let's reference some data from that file.
|
|
|
|
echo "variable1 (from data-file) = $variable1"
|
|
echo "variable3 (from data-file) = $variable3"
|
|
|
|
let "sum = $variable2 + $variable4"
|
|
echo "Sum of variable2 + variable4 (from data-file) = $sum"
|
|
echo "message1 (from data-file) is \"$message1\""
|
|
# Escaped quotes
|
|
echo "message2 (from data-file) is \"$message2\""
|
|
|
|
print_message This is the message-print function in the data-file.
|
|
|
|
|
|
exit $?
|