Pass Parameter to a redirected script in Linux
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I have two scripts, suppose they are s1.sh and s2.sh.
In s1, the code is
step = 0
.
.(omitted)
.
if [ $step -eq 19 ]; then
./s2.sh
In s2, the code is
step=0
.
. (many codes here, but omitted)
.
if [ $step -eq 18 ]; then
print "hello"
I want to run s1 from step 19, and then as s1 would call s2, I hope s2 could directly go to step 19 as well.
I heard someone talking about this before but I really could not remember the exact method. I am thinking the command codes to do this would be like :
./s1.sh --step 19 [some code?]--step 18
Any idea how to write the command line that could pass argument to two scripts as above ?
linux bash command
New contributor
add a comment |Â
up vote
0
down vote
favorite
I have two scripts, suppose they are s1.sh and s2.sh.
In s1, the code is
step = 0
.
.(omitted)
.
if [ $step -eq 19 ]; then
./s2.sh
In s2, the code is
step=0
.
. (many codes here, but omitted)
.
if [ $step -eq 18 ]; then
print "hello"
I want to run s1 from step 19, and then as s1 would call s2, I hope s2 could directly go to step 19 as well.
I heard someone talking about this before but I really could not remember the exact method. I am thinking the command codes to do this would be like :
./s1.sh --step 19 [some code?]--step 18
Any idea how to write the command line that could pass argument to two scripts as above ?
linux bash command
New contributor
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have two scripts, suppose they are s1.sh and s2.sh.
In s1, the code is
step = 0
.
.(omitted)
.
if [ $step -eq 19 ]; then
./s2.sh
In s2, the code is
step=0
.
. (many codes here, but omitted)
.
if [ $step -eq 18 ]; then
print "hello"
I want to run s1 from step 19, and then as s1 would call s2, I hope s2 could directly go to step 19 as well.
I heard someone talking about this before but I really could not remember the exact method. I am thinking the command codes to do this would be like :
./s1.sh --step 19 [some code?]--step 18
Any idea how to write the command line that could pass argument to two scripts as above ?
linux bash command
New contributor
I have two scripts, suppose they are s1.sh and s2.sh.
In s1, the code is
step = 0
.
.(omitted)
.
if [ $step -eq 19 ]; then
./s2.sh
In s2, the code is
step=0
.
. (many codes here, but omitted)
.
if [ $step -eq 18 ]; then
print "hello"
I want to run s1 from step 19, and then as s1 would call s2, I hope s2 could directly go to step 19 as well.
I heard someone talking about this before but I really could not remember the exact method. I am thinking the command codes to do this would be like :
./s1.sh --step 19 [some code?]--step 18
Any idea how to write the command line that could pass argument to two scripts as above ?
linux bash command
linux bash command
New contributor
New contributor
edited 1 min ago
New contributor
asked 11 mins ago
exteralvictor
1
1
New contributor
New contributor
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
Run export step
in s1. Once you do that, the step
variable will just be present in s2 without having to be explicitly passed when you call it.
I think export could work only two parameters are the same ? what if they are different ?
â exteralvictor
22 secs ago
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Run export step
in s1. Once you do that, the step
variable will just be present in s2 without having to be explicitly passed when you call it.
I think export could work only two parameters are the same ? what if they are different ?
â exteralvictor
22 secs ago
add a comment |Â
up vote
0
down vote
Run export step
in s1. Once you do that, the step
variable will just be present in s2 without having to be explicitly passed when you call it.
I think export could work only two parameters are the same ? what if they are different ?
â exteralvictor
22 secs ago
add a comment |Â
up vote
0
down vote
up vote
0
down vote
Run export step
in s1. Once you do that, the step
variable will just be present in s2 without having to be explicitly passed when you call it.
Run export step
in s1. Once you do that, the step
variable will just be present in s2 without having to be explicitly passed when you call it.
answered 4 mins ago
Joseph Sible
1,019213
1,019213
I think export could work only two parameters are the same ? what if they are different ?
â exteralvictor
22 secs ago
add a comment |Â
I think export could work only two parameters are the same ? what if they are different ?
â exteralvictor
22 secs ago
I think export could work only two parameters are the same ? what if they are different ?
â exteralvictor
22 secs ago
I think export could work only two parameters are the same ? what if they are different ?
â exteralvictor
22 secs ago
add a comment |Â
exteralvictor is a new contributor. Be nice, and check out our Code of Conduct.
exteralvictor is a new contributor. Be nice, and check out our Code of Conduct.
exteralvictor is a new contributor. Be nice, and check out our Code of Conduct.
exteralvictor is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f475216%2fpass-parameter-to-a-redirected-script-in-linux%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password