December 2015
Beginner
306 pages
5h 2m
English
We can create variables that may contain strings or numerical values. These global variables can be accessed by all the functions inside a script.
A simple script called function_11.sh with functions is as follows:
#!/bin/bash
# We will define variable temp for sharing data with function
temp="/temp/filename"
remove_file()
{
echo "removing file $temp..."
}
remove_fileTest the script as follows:
$ chmod +x function_11.sh $ ./function_11.sh
Output:
removing file /temp/filename...