Linked Questions

6
votes
1answer
5k views

Determine current shell name [duplicate]

Possible Duplicate: How to test what shell I am using in a terminal? How do I determine the current shell path or shell name? I only really need to distinguish sh and bash, however a portable ...
3
votes
2answers
6k views

How to detect the command interpreter from within a shell script? [duplicate]

Possible Duplicate: How to test what shell I am using in a terminal? I want to detect which interpreter a shell script is using. For example the following script: #!/bin/bash ...
0
votes
2answers
136 views

Is there a general command to see what shell is running? [duplicate]

On some the shell can be read on in the command prompt, other can be seen when help is ran. But this are not covered by all the shells. Is there a general command to see what shell is running?
2
votes
0answers
361 views

How can I check which shell I am currently using? [duplicate]

Possible Duplicate: How to test what shell I am using in a terminal? An echo $SHELL will only display the value of the SHELL variable which would indicate the default shell on the system. But I ...
21
votes
7answers
10k views

determine shell in script during runtime

As per my knowledge, to determine the current shell we use echo $0 in the shell. Rather I want my script to check in which shell it is running. So, I tried to print $0 in the script and it returns the ...
5
votes
6answers
24k views

Difference between “echo $SHELL” and “which bash”

I am trying to determine the location of bash interpreter on my Solaris system and I am a bit confused. When I type: echo $SHELL The resulting path is: /bin/bash And when I type: which bash I ...
7
votes
5answers
3k views

How do I *reliably* and *simply* get the current shell interpreter name?

I'm looking for a simple and reliable way to get the name of the current shell from inside a script or a sourced file (not from the command line). I would have expected to just do $(basename "$SHELL")...
4
votes
4answers
315 views

POSIX-compatible/cross-shell way to get version of running shell?

Is there a POSIX-compatible way or a way, which works on all shells, to get the version number of the shell, which is running? With $SHELL ps -p$$ -ocmd= you can get the name/binary, so $SHELL --...
3
votes
1answer
303 views

ssh behavior for root and non-root user

When I ssh as root to a remote machine, the command output looks like this: root@Machine:/current/path#: However, if it's a non-root user, all I see is: $ How can I get the same behavior as for ...
2
votes
1answer
185 views

cannot get scripts to run in a Lubuntu (Xenial) Minimal (+LXDE) VM with shebangs

I embarrassed myself a little here with a simple typo and a profound ignorance. Save yourself some grief: your hasbangs/shebangs must always have a leading /, such as #!/bin/bash be precise if you ...
0
votes
1answer
65 views

I can't find .bashrc on distro astro

I'm using distro astro 3, I tried to add something to .bashrc but I couldn't find it. When I ran the command ls -a ~, I could find only .bash_history & .bash_logout should I create a .bashrc or ...