0

I know that $SHELL is an environment-variable, which refers to the current default-shell. echo $SHELL prints the path to stdout.

Here the use of it for keeping the terminal window open: How to run a script without closing the terminal?

What does $SHELL do, when it is entered like a some command?

Gryu
  • 7,559
  • 9
  • 33
  • 52
st88
  • 13

1 Answers1

0

It is expanded, and its content is interpreted as a command to run. For example, if it contains /bin/bash, it will run /bin/bash, i.e. it will start a new bash shell.

In the particular example, it prevents the terminal from being closed, as the shell is running in interactive mode, i.e. waiting for the user to type in commands.

choroba
  • 9,643
  • Ah, okay. Basically, it opens another command prompt below. And that then keeps the terminal open, because waiting for an user-insertion? – st88 Feb 07 '20 at 09:30
  • Yes, exactly. When you exit the shell, the window will be closed. – choroba Feb 07 '20 at 10:32