How Do I Pass a Variable from One Script to Another in Unix?
Contents How Do I Pass a Variable from One Shell Script to Another? You Have Basically Two Options: Make the Variable an Environment Variable ( Export...
Contents
How do I pass a variable from one shell script to another?
You have basically two options:
- Make the variable an environment variable ( export TESTVARIABLE ) before executing the 2nd script.
- Source the 2nd script, i.e. . test2.sh and it will run in the same shell.
Must Read
How do you pass a variable in UNIX?
Arguments or variables may be passed to a shell script. Simply list the arguments on the command line when running a shell script. In the shell script, $0 is the name of the command run (usually the name of the shell script file); $1 is the first argument, $2 is the second argument, $3 is the third argument, etc…