Variables between shell scripts
Hi
Ive created some custom shell scripts to run during the kernels boot process (they are called from the init script). I was wondering if there's any way to assign a variable that can be accessed between different scripts. For example my first script checks which type of pc i am installing on and assigns the hard drive location to a variable. HARDDRIVE = "/dev/sda1" at the end of the script it calls another script. In this script I cant reference HARDDRIVE as it is blank, to get around this I need to repeat the same code for assigning it. Its more of a space/aesthetics issue but I figured someone might know the solution off the top of their head. Thanks :D |
If a script (child) is called by another script (parent) you can export variables in the parent script to make them available to the childs, e.g.
Code:
export HARDDRIVE="/dev/sda1" Code:
. /path/to/script1 |
All times are GMT -5. The time now is 04:56 PM. |