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

26 lines
782 B
Bash
Raw Normal View History

2001-07-10 14:25:50 +00:00
#!/bin/bash
2012-11-27 14:56:18 +00:00
# Note that this example must be invoked with bash, i.e., bash ex38.sh
#+ not sh ex38.sh !
2001-07-10 14:25:50 +00:00
2001-09-04 13:27:31 +00:00
. data-file # Load a data file.
2001-07-10 14:25:50 +00:00
# Same effect as "source data-file", but more portable.
2002-04-01 16:04:17 +00:00
# The file "data-file" must be present in current working directory,
2012-11-27 14:56:18 +00:00
#+ since it is referred to by its basename.
2001-07-10 14:25:50 +00:00
2012-11-27 14:56:18 +00:00
# Now, let's reference some data from that file.
2001-07-10 14:25:50 +00:00
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\""
2012-11-27 14:56:18 +00:00
# Escaped quotes
echo "message2 (from data-file) is \"$message2\""
2001-07-10 14:25:50 +00:00
print_message This is the message-print function in the data-file.
2012-11-27 14:56:18 +00:00
exit $?