Where is the command lines stored before it is executed?
Clash Royale CLAN TAG#URR8PPP
up vote
-1
down vote
favorite
I have such a script in ~/draft
$ cat test.sh
#! /usr/local/bin/bash
for i in ./*;do
echo $i
done
The chunk of code are stored in test.sh
,
when I run it
$ bash test.sh
./first.html
./second.html
./test.sh
./third.html
So I run the script name test.sh
and get the output.
Alternatively, I could run the command directly as:
$ for i in ./*; do echo $i; done
./first.html
./second.html
./test.sh
./third.html
The second chunk get the identical results.
Since the preceding codes resides in file test.sh
, what's the filename where the command for i in ./*; do echo $i; done
live?
bash
New contributor
add a comment |Â
up vote
-1
down vote
favorite
I have such a script in ~/draft
$ cat test.sh
#! /usr/local/bin/bash
for i in ./*;do
echo $i
done
The chunk of code are stored in test.sh
,
when I run it
$ bash test.sh
./first.html
./second.html
./test.sh
./third.html
So I run the script name test.sh
and get the output.
Alternatively, I could run the command directly as:
$ for i in ./*; do echo $i; done
./first.html
./second.html
./test.sh
./third.html
The second chunk get the identical results.
Since the preceding codes resides in file test.sh
, what's the filename where the command for i in ./*; do echo $i; done
live?
bash
New contributor
add a comment |Â
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
I have such a script in ~/draft
$ cat test.sh
#! /usr/local/bin/bash
for i in ./*;do
echo $i
done
The chunk of code are stored in test.sh
,
when I run it
$ bash test.sh
./first.html
./second.html
./test.sh
./third.html
So I run the script name test.sh
and get the output.
Alternatively, I could run the command directly as:
$ for i in ./*; do echo $i; done
./first.html
./second.html
./test.sh
./third.html
The second chunk get the identical results.
Since the preceding codes resides in file test.sh
, what's the filename where the command for i in ./*; do echo $i; done
live?
bash
New contributor
I have such a script in ~/draft
$ cat test.sh
#! /usr/local/bin/bash
for i in ./*;do
echo $i
done
The chunk of code are stored in test.sh
,
when I run it
$ bash test.sh
./first.html
./second.html
./test.sh
./third.html
So I run the script name test.sh
and get the output.
Alternatively, I could run the command directly as:
$ for i in ./*; do echo $i; done
./first.html
./second.html
./test.sh
./third.html
The second chunk get the identical results.
Since the preceding codes resides in file test.sh
, what's the filename where the command for i in ./*; do echo $i; done
live?
bash
bash
New contributor
New contributor
edited 3 mins ago
Kusalananda
111k15216342
111k15216342
New contributor
asked 1 hour ago
rider dragon
22716
22716
New contributor
New contributor
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
Commands don't have to be stored in a file to be executed - the interpreter (in this case bash
) can simply read the command line into memory like it would read a script file (with some minor caveats related to buffering) and then execute it in exactly the same way.
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
Commands don't have to be stored in a file to be executed - the interpreter (in this case bash
) can simply read the command line into memory like it would read a script file (with some minor caveats related to buffering) and then execute it in exactly the same way.
add a comment |Â
up vote
0
down vote
Commands don't have to be stored in a file to be executed - the interpreter (in this case bash
) can simply read the command line into memory like it would read a script file (with some minor caveats related to buffering) and then execute it in exactly the same way.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
Commands don't have to be stored in a file to be executed - the interpreter (in this case bash
) can simply read the command line into memory like it would read a script file (with some minor caveats related to buffering) and then execute it in exactly the same way.
Commands don't have to be stored in a file to be executed - the interpreter (in this case bash
) can simply read the command line into memory like it would read a script file (with some minor caveats related to buffering) and then execute it in exactly the same way.
answered 34 mins ago
l0b0
26.8k17107236
26.8k17107236
add a comment |Â
add a comment |Â
rider dragon is a new contributor. Be nice, and check out our Code of Conduct.
rider dragon is a new contributor. Be nice, and check out our Code of Conduct.
rider dragon is a new contributor. Be nice, and check out our Code of Conduct.
rider dragon 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%2f477670%2fwhere-is-the-command-lines-stored-before-it-is-executed%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