Linked Questions

5 votes
2 answers
11k 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 ...
Ingo's user avatar
  • 51
9 votes
1 answer
8k 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 ...
Tyilo's user avatar
  • 6,209
0 votes
2 answers
178 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?
Eduard Florinescu's user avatar
2 votes
0 answers
379 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 ...
Lazer's user avatar
  • 36.2k
46 votes
8 answers
22k 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 ...
g4ur4v's user avatar
  • 1,884
7 votes
6 answers
47k 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 get: ...
Eugene S's user avatar
  • 3,534
12 votes
8 answers
11k 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")...
iconoclast's user avatar
  • 9,432
5 votes
4 answers
2k 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 --...
rugk's user avatar
  • 3,646
1 vote
2 answers
2k views

Creating a shell script version of terminal commands

I am just starting to learn the basics of Linux terminal and I'm a little confused on converting terminal commands into shell script. How would I approach creating a script file in the Linux terminal ...
user10649856's user avatar
2 votes
1 answer
566 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 ...
j doe will do just fine's user avatar
3 votes
1 answer
396 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 the ...
m33lky's user avatar
  • 2,745
0 votes
1 answer
103 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 ...
Ola Ali's user avatar