hi,
How to use one shell script file in other shell scrpt file
for example
main shell script(have different lines of code)
...........
........
...........
sub shell script(with three parameters)
.........
...........
end
thanks
hi,
How to use one shell script file in other shell scrpt file
for example
main shell script(have different lines of code)
...........
........
...........
sub shell script(with three parameters)
.........
...........
end
thanks
$ cat main.sh
#! /bin/bash
echo "Main script. Invoking sub script..."
bash sub_script.sh
echo "Back to main script."
$
$ cat sub_script.sh
#! /bin/bash
echo "In sub script"
$
If you need more specific answers, please be a bit more verbose while describing your requirements.
like this ?
# cat 1.sh
#!/bin/bash
## main shell script
echo "MAIN SHELL SCRIPT is working..."
sleep 2
echo
## sub shell script
./2.sh 111 222 333
# cat 2.sh
#!/bin/bash
echo "SUB SHELL SCRIPT is processing with $1 $2 and $3 parameters"
sleep 2
# ./1.sh
MAIN SHELL SCRIPT is working...
SUB SHELL SCRIPT is processing with 111 222 and 333 parameters
how to pass dynamic parameters
change this
.................
## sub shell script
./2.sh $1 $2 $3
# ./1.sh 111 222 333
MAIN SHELL SCRIPT is working...
SUB SHELL SCRIPT is processing with 111 222 and 333 parameters