Linux Shell Scripting TutorialIntroduction 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 files
Sourcing in linux shell scripting“source” command is used to source any valid shell script file. Here is the syntax of source command.
Main purpose of source command is that we can use functions or commands defined in another file in any other script or from in shell prompt. Note that if you want to execute any script file, you should have a execute permission on that file. But When you use “source” command, you do not need to have a execute permission on that file. Suppose you have simple script file – “s1.sh” with below contents
Now to execute “s1.sh”, you can use below command.
$ source s1.sh
Complex problems, Simple Solutions