Linux Shell Scripting Tutorial
Introduction Tools required for shell scripting First shell script Interacting with user Operators Special characters in BASH scripting Variables in Linux BASH scripting Arrays Integer operations floating point operations String manipulation in shell scripting Parameter substitution Command Substitution Conditional statements Looping statements Passing parameters exit status of the script Functions Sourcing filesfunctions in linux shell scripting
Main use of functions is that we can reuse the same code and we can call the same function many times. We can write functions in shell scripts, using below syntax. To call the function, you can just use the name of the function as a command. Note that definition of the function should appear first in a bash file and then we can call the function. If you try to call the function before defining it, you will get an error saying “command not found”
f1 ()
{
echo “This is a simple function in Linux shell scripting”
}
f1
Web development and Automation testing
solutions delivered!!