Does creating a new shell via bash -c passes environment
up vote
0
down vote
favorite
Assuming we want to run multiple bash commands via
bash -c "command1 && command2 || command3"
Will the new shell inherit the environment of the bash -c
command?
bash environment-variables
add a comment |
up vote
0
down vote
favorite
Assuming we want to run multiple bash commands via
bash -c "command1 && command2 || command3"
Will the new shell inherit the environment of the bash -c
command?
bash environment-variables
1
Sorry, what is "the new shell" that you are referring to? Thebash -c
shell will inherit the environment of the calling shell, and the commands within will inherit the environment of thebash -c
shell that they are started from.
– Kusalananda
yesterday
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Assuming we want to run multiple bash commands via
bash -c "command1 && command2 || command3"
Will the new shell inherit the environment of the bash -c
command?
bash environment-variables
Assuming we want to run multiple bash commands via
bash -c "command1 && command2 || command3"
Will the new shell inherit the environment of the bash -c
command?
bash environment-variables
bash environment-variables
asked yesterday
pkaramol
430216
430216
1
Sorry, what is "the new shell" that you are referring to? Thebash -c
shell will inherit the environment of the calling shell, and the commands within will inherit the environment of thebash -c
shell that they are started from.
– Kusalananda
yesterday
add a comment |
1
Sorry, what is "the new shell" that you are referring to? Thebash -c
shell will inherit the environment of the calling shell, and the commands within will inherit the environment of thebash -c
shell that they are started from.
– Kusalananda
yesterday
1
1
Sorry, what is "the new shell" that you are referring to? The
bash -c
shell will inherit the environment of the calling shell, and the commands within will inherit the environment of the bash -c
shell that they are started from.– Kusalananda
yesterday
Sorry, what is "the new shell" that you are referring to? The
bash -c
shell will inherit the environment of the calling shell, and the commands within will inherit the environment of the bash -c
shell that they are started from.– Kusalananda
yesterday
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
Environment variables will be available to the new process. The private shell variables will not.
New contributor
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
Environment variables will be available to the new process. The private shell variables will not.
New contributor
add a comment |
up vote
0
down vote
Environment variables will be available to the new process. The private shell variables will not.
New contributor
add a comment |
up vote
0
down vote
up vote
0
down vote
Environment variables will be available to the new process. The private shell variables will not.
New contributor
Environment variables will be available to the new process. The private shell variables will not.
New contributor
New contributor
answered yesterday
Richard Barber
1095
1095
New contributor
New contributor
add a comment |
add a comment |
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f482096%2fdoes-creating-a-new-shell-via-bash-c-passes-environment%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Sorry, what is "the new shell" that you are referring to? The
bash -c
shell will inherit the environment of the calling shell, and the commands within will inherit the environment of thebash -c
shell that they are started from.– Kusalananda
yesterday