While I was referring to usage of SOURCE in linux, I got to know that from here source executes the command in current shell and "./" will execute in new shell.

My question is how do we know in which shell the commands are getting executed ?

closed as unclear what you're asking by gronostaj, DavidPostill Apr 12 '17 at 11:39

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • The confusion arise when I saw the terms current shell and new shell. I am just checking how to check the current and new shell. May be the same query could be posted in different way. – Here_2_learn Apr 13 '17 at 6:41

Most (if not all) shells on Linux provide you with the $SHELL environment variable:

mtak@frisbee:~$ echo $SHELL

It's still a better practice to run with ./ and provide a shell in the script you're running (that's in the first line starting with #!). This way you get more consistent results.

Not the answer you're looking for? Browse other questions tagged or ask your own question.