How to know, what SHELL is used when running a script?
How can I output that what shell is used to execute a script?
Ex.: the $SHELL variable gives that what is the default shell for the given user. That is ok, but the given user can launch the script with other shell, ex.: "sh script.sh" or "csh script.sh".
Using a Linux machine.
scripting
add a comment |
How can I output that what shell is used to execute a script?
Ex.: the $SHELL variable gives that what is the default shell for the given user. That is ok, but the given user can launch the script with other shell, ex.: "sh script.sh" or "csh script.sh".
Using a Linux machine.
scripting
Rare is the script that can work with bothshandcsh.
– JdeBP
2 hours ago
Those shells were just examples. The question is that how to know, with what shell is the script actually used in reality.
– cirka547
2 hours ago
2
I don't see why this should even be a problem. Don't you use a#!-line in the script? This is never an issue with e.g. Perl, Python or Ruby scripts, so it shouldn't be an issue for a script written for some other interpreter.
– Kusalananda
1 hour ago
add a comment |
How can I output that what shell is used to execute a script?
Ex.: the $SHELL variable gives that what is the default shell for the given user. That is ok, but the given user can launch the script with other shell, ex.: "sh script.sh" or "csh script.sh".
Using a Linux machine.
scripting
How can I output that what shell is used to execute a script?
Ex.: the $SHELL variable gives that what is the default shell for the given user. That is ok, but the given user can launch the script with other shell, ex.: "sh script.sh" or "csh script.sh".
Using a Linux machine.
scripting
scripting
asked 2 hours ago
cirka547cirka547
194
194
Rare is the script that can work with bothshandcsh.
– JdeBP
2 hours ago
Those shells were just examples. The question is that how to know, with what shell is the script actually used in reality.
– cirka547
2 hours ago
2
I don't see why this should even be a problem. Don't you use a#!-line in the script? This is never an issue with e.g. Perl, Python or Ruby scripts, so it shouldn't be an issue for a script written for some other interpreter.
– Kusalananda
1 hour ago
add a comment |
Rare is the script that can work with bothshandcsh.
– JdeBP
2 hours ago
Those shells were just examples. The question is that how to know, with what shell is the script actually used in reality.
– cirka547
2 hours ago
2
I don't see why this should even be a problem. Don't you use a#!-line in the script? This is never an issue with e.g. Perl, Python or Ruby scripts, so it shouldn't be an issue for a script written for some other interpreter.
– Kusalananda
1 hour ago
Rare is the script that can work with both
sh and csh.– JdeBP
2 hours ago
Rare is the script that can work with both
sh and csh.– JdeBP
2 hours ago
Those shells were just examples. The question is that how to know, with what shell is the script actually used in reality.
– cirka547
2 hours ago
Those shells were just examples. The question is that how to know, with what shell is the script actually used in reality.
– cirka547
2 hours ago
2
2
I don't see why this should even be a problem. Don't you use a
#!-line in the script? This is never an issue with e.g. Perl, Python or Ruby scripts, so it shouldn't be an issue for a script written for some other interpreter.– Kusalananda
1 hour ago
I don't see why this should even be a problem. Don't you use a
#!-line in the script? This is never an issue with e.g. Perl, Python or Ruby scripts, so it shouldn't be an issue for a script written for some other interpreter.– Kusalananda
1 hour ago
add a comment |
2 Answers
2
active
oldest
votes
Since you specified Linux, this is doable with readlink -f /proc/$$/exe. That will give you (on standard output) the path the the shell executing your shell script (something like /bin/bash). So you could assign it to a variable (at least in POSIX shell) with var=$(readlink -f /proc/$$/exe).
$$ is the pid of the current shell; /proc/«pid»/exe is a kernel feature that lets you query the executable being run in a given pid, in the form of a somewhat "magical" symlink. So you can use readlink to get the path.
On non-Linux, you should be able to use ps, e.g., ps -o args= $$ but that may wind up giving you the script name instead (POSIX allows either behavior).
Except if your script is designed to be sourced to, e.g., set variables in the user's shell, you really ought to use a #! line up top instead to specify which shell to run it under.
add a comment |
An individual script should not have to test what interpreter it's running in. That kind of introspection is awkward and error prone and would possibly have to be implemented differently for different Unices.
For example, a Perl script can always safely assume that it's being interpreted by a Perl interpreter, a Python script is always run by a Python interpreter, and so on. So why should not a bash script assume that it's being run by bash, and an sh script that it's being run by /bin/sh?
Testing specific capabilities of the current interpreter is a different issue, and e.g. bash offers $BASH_VERSION and the $BASH_VERSINFO array to test a version against (for example).
So how can you make e.g. a bash script be run by bash and a csh script be run by csh? Well, you avoid letting the user pick the interpreter.
You can do that by
Not putting a filename suffix on the script file, in case that would "confuse" the user. A
bashscript in amyscript.shfile might make the user think it would be runnable withsh. Instead, just call the scriptmyscript, and ...Use a
#!("shebang" or "hashbang") line.
A #!-line goes on the very first line of the script (the two characters #! have to be the first in the file) and specifies the path to the interpreter to use.
A bash script may have
#!/bin/bash
if that's the path to the bash executable on your system, or if you want bash to be picked up from wherever in $PATH it's located on your system it could have,
#!/usr/bin/env bash
as its first line, for example.
This ensures that it will always be interpreted by bash and not by sh or csh or python or some other unrelated language interpreter.
The next step would be to
- Make the script executable, using
chmod +x myscript.
Now you can run your script with
./myscript
without bothering with what interpreter to use for executing it. In fact, to the user of the script, it would not matter at all whether it was a bash script, a Python script, or a compiled binary.
There is one case you can't use a #! line: when your script is supposed to be sourced into the user's active shell (e.g., to set variables, aliases, or functions)
– derobert
1 hour ago
@derobert I would argue that trying to source abashdot-script in ashscript would be the same kind of user error as trying to load a Python module in Perl. You just wouldn't do that. In any case, you wouldn't try to detect that inside some polyglot script.
– Kusalananda
58 mins ago
It'd be pretty reasonable, for example, to have one script used for all POSIX-sh compatible (enough) shells, and then only enable additional functionality when detecting bash, zsh, etc. That'd make for an easier user (and documentation) experience than a separate script depending on which shell your users happen to be using. And indeed sometimes it's actually required — e.g., in/etc/profile.
– derobert
51 mins ago
@derobert I do agree that/etc/profilemay be an exception, if you need to differentiate between e.g.dash,bashandksh(zshuses another file, andyashdoes not read files under/etcby default at all).
– Kusalananda
44 mins ago
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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%2f506141%2fhow-to-know-what-shell-is-used-when-running-a-script%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Since you specified Linux, this is doable with readlink -f /proc/$$/exe. That will give you (on standard output) the path the the shell executing your shell script (something like /bin/bash). So you could assign it to a variable (at least in POSIX shell) with var=$(readlink -f /proc/$$/exe).
$$ is the pid of the current shell; /proc/«pid»/exe is a kernel feature that lets you query the executable being run in a given pid, in the form of a somewhat "magical" symlink. So you can use readlink to get the path.
On non-Linux, you should be able to use ps, e.g., ps -o args= $$ but that may wind up giving you the script name instead (POSIX allows either behavior).
Except if your script is designed to be sourced to, e.g., set variables in the user's shell, you really ought to use a #! line up top instead to specify which shell to run it under.
add a comment |
Since you specified Linux, this is doable with readlink -f /proc/$$/exe. That will give you (on standard output) the path the the shell executing your shell script (something like /bin/bash). So you could assign it to a variable (at least in POSIX shell) with var=$(readlink -f /proc/$$/exe).
$$ is the pid of the current shell; /proc/«pid»/exe is a kernel feature that lets you query the executable being run in a given pid, in the form of a somewhat "magical" symlink. So you can use readlink to get the path.
On non-Linux, you should be able to use ps, e.g., ps -o args= $$ but that may wind up giving you the script name instead (POSIX allows either behavior).
Except if your script is designed to be sourced to, e.g., set variables in the user's shell, you really ought to use a #! line up top instead to specify which shell to run it under.
add a comment |
Since you specified Linux, this is doable with readlink -f /proc/$$/exe. That will give you (on standard output) the path the the shell executing your shell script (something like /bin/bash). So you could assign it to a variable (at least in POSIX shell) with var=$(readlink -f /proc/$$/exe).
$$ is the pid of the current shell; /proc/«pid»/exe is a kernel feature that lets you query the executable being run in a given pid, in the form of a somewhat "magical" symlink. So you can use readlink to get the path.
On non-Linux, you should be able to use ps, e.g., ps -o args= $$ but that may wind up giving you the script name instead (POSIX allows either behavior).
Except if your script is designed to be sourced to, e.g., set variables in the user's shell, you really ought to use a #! line up top instead to specify which shell to run it under.
Since you specified Linux, this is doable with readlink -f /proc/$$/exe. That will give you (on standard output) the path the the shell executing your shell script (something like /bin/bash). So you could assign it to a variable (at least in POSIX shell) with var=$(readlink -f /proc/$$/exe).
$$ is the pid of the current shell; /proc/«pid»/exe is a kernel feature that lets you query the executable being run in a given pid, in the form of a somewhat "magical" symlink. So you can use readlink to get the path.
On non-Linux, you should be able to use ps, e.g., ps -o args= $$ but that may wind up giving you the script name instead (POSIX allows either behavior).
Except if your script is designed to be sourced to, e.g., set variables in the user's shell, you really ought to use a #! line up top instead to specify which shell to run it under.
edited 59 mins ago
answered 1 hour ago
derobertderobert
74.5k8162219
74.5k8162219
add a comment |
add a comment |
An individual script should not have to test what interpreter it's running in. That kind of introspection is awkward and error prone and would possibly have to be implemented differently for different Unices.
For example, a Perl script can always safely assume that it's being interpreted by a Perl interpreter, a Python script is always run by a Python interpreter, and so on. So why should not a bash script assume that it's being run by bash, and an sh script that it's being run by /bin/sh?
Testing specific capabilities of the current interpreter is a different issue, and e.g. bash offers $BASH_VERSION and the $BASH_VERSINFO array to test a version against (for example).
So how can you make e.g. a bash script be run by bash and a csh script be run by csh? Well, you avoid letting the user pick the interpreter.
You can do that by
Not putting a filename suffix on the script file, in case that would "confuse" the user. A
bashscript in amyscript.shfile might make the user think it would be runnable withsh. Instead, just call the scriptmyscript, and ...Use a
#!("shebang" or "hashbang") line.
A #!-line goes on the very first line of the script (the two characters #! have to be the first in the file) and specifies the path to the interpreter to use.
A bash script may have
#!/bin/bash
if that's the path to the bash executable on your system, or if you want bash to be picked up from wherever in $PATH it's located on your system it could have,
#!/usr/bin/env bash
as its first line, for example.
This ensures that it will always be interpreted by bash and not by sh or csh or python or some other unrelated language interpreter.
The next step would be to
- Make the script executable, using
chmod +x myscript.
Now you can run your script with
./myscript
without bothering with what interpreter to use for executing it. In fact, to the user of the script, it would not matter at all whether it was a bash script, a Python script, or a compiled binary.
There is one case you can't use a #! line: when your script is supposed to be sourced into the user's active shell (e.g., to set variables, aliases, or functions)
– derobert
1 hour ago
@derobert I would argue that trying to source abashdot-script in ashscript would be the same kind of user error as trying to load a Python module in Perl. You just wouldn't do that. In any case, you wouldn't try to detect that inside some polyglot script.
– Kusalananda
58 mins ago
It'd be pretty reasonable, for example, to have one script used for all POSIX-sh compatible (enough) shells, and then only enable additional functionality when detecting bash, zsh, etc. That'd make for an easier user (and documentation) experience than a separate script depending on which shell your users happen to be using. And indeed sometimes it's actually required — e.g., in/etc/profile.
– derobert
51 mins ago
@derobert I do agree that/etc/profilemay be an exception, if you need to differentiate between e.g.dash,bashandksh(zshuses another file, andyashdoes not read files under/etcby default at all).
– Kusalananda
44 mins ago
add a comment |
An individual script should not have to test what interpreter it's running in. That kind of introspection is awkward and error prone and would possibly have to be implemented differently for different Unices.
For example, a Perl script can always safely assume that it's being interpreted by a Perl interpreter, a Python script is always run by a Python interpreter, and so on. So why should not a bash script assume that it's being run by bash, and an sh script that it's being run by /bin/sh?
Testing specific capabilities of the current interpreter is a different issue, and e.g. bash offers $BASH_VERSION and the $BASH_VERSINFO array to test a version against (for example).
So how can you make e.g. a bash script be run by bash and a csh script be run by csh? Well, you avoid letting the user pick the interpreter.
You can do that by
Not putting a filename suffix on the script file, in case that would "confuse" the user. A
bashscript in amyscript.shfile might make the user think it would be runnable withsh. Instead, just call the scriptmyscript, and ...Use a
#!("shebang" or "hashbang") line.
A #!-line goes on the very first line of the script (the two characters #! have to be the first in the file) and specifies the path to the interpreter to use.
A bash script may have
#!/bin/bash
if that's the path to the bash executable on your system, or if you want bash to be picked up from wherever in $PATH it's located on your system it could have,
#!/usr/bin/env bash
as its first line, for example.
This ensures that it will always be interpreted by bash and not by sh or csh or python or some other unrelated language interpreter.
The next step would be to
- Make the script executable, using
chmod +x myscript.
Now you can run your script with
./myscript
without bothering with what interpreter to use for executing it. In fact, to the user of the script, it would not matter at all whether it was a bash script, a Python script, or a compiled binary.
There is one case you can't use a #! line: when your script is supposed to be sourced into the user's active shell (e.g., to set variables, aliases, or functions)
– derobert
1 hour ago
@derobert I would argue that trying to source abashdot-script in ashscript would be the same kind of user error as trying to load a Python module in Perl. You just wouldn't do that. In any case, you wouldn't try to detect that inside some polyglot script.
– Kusalananda
58 mins ago
It'd be pretty reasonable, for example, to have one script used for all POSIX-sh compatible (enough) shells, and then only enable additional functionality when detecting bash, zsh, etc. That'd make for an easier user (and documentation) experience than a separate script depending on which shell your users happen to be using. And indeed sometimes it's actually required — e.g., in/etc/profile.
– derobert
51 mins ago
@derobert I do agree that/etc/profilemay be an exception, if you need to differentiate between e.g.dash,bashandksh(zshuses another file, andyashdoes not read files under/etcby default at all).
– Kusalananda
44 mins ago
add a comment |
An individual script should not have to test what interpreter it's running in. That kind of introspection is awkward and error prone and would possibly have to be implemented differently for different Unices.
For example, a Perl script can always safely assume that it's being interpreted by a Perl interpreter, a Python script is always run by a Python interpreter, and so on. So why should not a bash script assume that it's being run by bash, and an sh script that it's being run by /bin/sh?
Testing specific capabilities of the current interpreter is a different issue, and e.g. bash offers $BASH_VERSION and the $BASH_VERSINFO array to test a version against (for example).
So how can you make e.g. a bash script be run by bash and a csh script be run by csh? Well, you avoid letting the user pick the interpreter.
You can do that by
Not putting a filename suffix on the script file, in case that would "confuse" the user. A
bashscript in amyscript.shfile might make the user think it would be runnable withsh. Instead, just call the scriptmyscript, and ...Use a
#!("shebang" or "hashbang") line.
A #!-line goes on the very first line of the script (the two characters #! have to be the first in the file) and specifies the path to the interpreter to use.
A bash script may have
#!/bin/bash
if that's the path to the bash executable on your system, or if you want bash to be picked up from wherever in $PATH it's located on your system it could have,
#!/usr/bin/env bash
as its first line, for example.
This ensures that it will always be interpreted by bash and not by sh or csh or python or some other unrelated language interpreter.
The next step would be to
- Make the script executable, using
chmod +x myscript.
Now you can run your script with
./myscript
without bothering with what interpreter to use for executing it. In fact, to the user of the script, it would not matter at all whether it was a bash script, a Python script, or a compiled binary.
An individual script should not have to test what interpreter it's running in. That kind of introspection is awkward and error prone and would possibly have to be implemented differently for different Unices.
For example, a Perl script can always safely assume that it's being interpreted by a Perl interpreter, a Python script is always run by a Python interpreter, and so on. So why should not a bash script assume that it's being run by bash, and an sh script that it's being run by /bin/sh?
Testing specific capabilities of the current interpreter is a different issue, and e.g. bash offers $BASH_VERSION and the $BASH_VERSINFO array to test a version against (for example).
So how can you make e.g. a bash script be run by bash and a csh script be run by csh? Well, you avoid letting the user pick the interpreter.
You can do that by
Not putting a filename suffix on the script file, in case that would "confuse" the user. A
bashscript in amyscript.shfile might make the user think it would be runnable withsh. Instead, just call the scriptmyscript, and ...Use a
#!("shebang" or "hashbang") line.
A #!-line goes on the very first line of the script (the two characters #! have to be the first in the file) and specifies the path to the interpreter to use.
A bash script may have
#!/bin/bash
if that's the path to the bash executable on your system, or if you want bash to be picked up from wherever in $PATH it's located on your system it could have,
#!/usr/bin/env bash
as its first line, for example.
This ensures that it will always be interpreted by bash and not by sh or csh or python or some other unrelated language interpreter.
The next step would be to
- Make the script executable, using
chmod +x myscript.
Now you can run your script with
./myscript
without bothering with what interpreter to use for executing it. In fact, to the user of the script, it would not matter at all whether it was a bash script, a Python script, or a compiled binary.
edited 51 mins ago
answered 1 hour ago
KusalanandaKusalananda
135k17255422
135k17255422
There is one case you can't use a #! line: when your script is supposed to be sourced into the user's active shell (e.g., to set variables, aliases, or functions)
– derobert
1 hour ago
@derobert I would argue that trying to source abashdot-script in ashscript would be the same kind of user error as trying to load a Python module in Perl. You just wouldn't do that. In any case, you wouldn't try to detect that inside some polyglot script.
– Kusalananda
58 mins ago
It'd be pretty reasonable, for example, to have one script used for all POSIX-sh compatible (enough) shells, and then only enable additional functionality when detecting bash, zsh, etc. That'd make for an easier user (and documentation) experience than a separate script depending on which shell your users happen to be using. And indeed sometimes it's actually required — e.g., in/etc/profile.
– derobert
51 mins ago
@derobert I do agree that/etc/profilemay be an exception, if you need to differentiate between e.g.dash,bashandksh(zshuses another file, andyashdoes not read files under/etcby default at all).
– Kusalananda
44 mins ago
add a comment |
There is one case you can't use a #! line: when your script is supposed to be sourced into the user's active shell (e.g., to set variables, aliases, or functions)
– derobert
1 hour ago
@derobert I would argue that trying to source abashdot-script in ashscript would be the same kind of user error as trying to load a Python module in Perl. You just wouldn't do that. In any case, you wouldn't try to detect that inside some polyglot script.
– Kusalananda
58 mins ago
It'd be pretty reasonable, for example, to have one script used for all POSIX-sh compatible (enough) shells, and then only enable additional functionality when detecting bash, zsh, etc. That'd make for an easier user (and documentation) experience than a separate script depending on which shell your users happen to be using. And indeed sometimes it's actually required — e.g., in/etc/profile.
– derobert
51 mins ago
@derobert I do agree that/etc/profilemay be an exception, if you need to differentiate between e.g.dash,bashandksh(zshuses another file, andyashdoes not read files under/etcby default at all).
– Kusalananda
44 mins ago
There is one case you can't use a #! line: when your script is supposed to be sourced into the user's active shell (e.g., to set variables, aliases, or functions)
– derobert
1 hour ago
There is one case you can't use a #! line: when your script is supposed to be sourced into the user's active shell (e.g., to set variables, aliases, or functions)
– derobert
1 hour ago
@derobert I would argue that trying to source a
bash dot-script in a sh script would be the same kind of user error as trying to load a Python module in Perl. You just wouldn't do that. In any case, you wouldn't try to detect that inside some polyglot script.– Kusalananda
58 mins ago
@derobert I would argue that trying to source a
bash dot-script in a sh script would be the same kind of user error as trying to load a Python module in Perl. You just wouldn't do that. In any case, you wouldn't try to detect that inside some polyglot script.– Kusalananda
58 mins ago
It'd be pretty reasonable, for example, to have one script used for all POSIX-sh compatible (enough) shells, and then only enable additional functionality when detecting bash, zsh, etc. That'd make for an easier user (and documentation) experience than a separate script depending on which shell your users happen to be using. And indeed sometimes it's actually required — e.g., in
/etc/profile.– derobert
51 mins ago
It'd be pretty reasonable, for example, to have one script used for all POSIX-sh compatible (enough) shells, and then only enable additional functionality when detecting bash, zsh, etc. That'd make for an easier user (and documentation) experience than a separate script depending on which shell your users happen to be using. And indeed sometimes it's actually required — e.g., in
/etc/profile.– derobert
51 mins ago
@derobert I do agree that
/etc/profile may be an exception, if you need to differentiate between e.g. dash, bash and ksh (zsh uses another file, and yash does not read files under /etc by default at all).– Kusalananda
44 mins ago
@derobert I do agree that
/etc/profile may be an exception, if you need to differentiate between e.g. dash, bash and ksh (zsh uses another file, and yash does not read files under /etc by default at all).– Kusalananda
44 mins ago
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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%2f506141%2fhow-to-know-what-shell-is-used-when-running-a-script%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
Rare is the script that can work with both
shandcsh.– JdeBP
2 hours ago
Those shells were just examples. The question is that how to know, with what shell is the script actually used in reality.
– cirka547
2 hours ago
2
I don't see why this should even be a problem. Don't you use a
#!-line in the script? This is never an issue with e.g. Perl, Python or Ruby scripts, so it shouldn't be an issue for a script written for some other interpreter.– Kusalananda
1 hour ago