Skip to main content
added 191 characters in body
Source Link
Inian
  • 13.1k
  • 2
  • 42
  • 55

Because when you run a script, the parent shell (the one you run your commands from) starts a non-interactive shell to run your script which has interactive flag disabled i and only turns on two options

  • -h to locate and remember (hash) commands as they are looked up for execution.
  • -B to allow the shell to perform brace expansion

You can see the complete list of set options which will be seen in the output of $- - The Set Builtin

Other options available in the interactive shell, -i to indicate to run the shell in interactive mode

  • -m to allow Job control
  • -H to enable ! style history substitution

Because when you run a script, the parent shell (the one you run your commands from) starts a non-interactive shell to run your script which has interactive flag disabled i and only turns on two options

  • -h to locate and remember (hash) commands as they are looked up for execution.
  • -B to allow the shell to perform brace expansion

You can see the complete list of set options which will be seen in the output of $- - The Set Builtin

Because when you run a script, the parent shell (the one you run your commands from) starts a non-interactive shell to run your script which has interactive flag disabled i and only turns on two options

  • -h to locate and remember (hash) commands as they are looked up for execution.
  • -B to allow the shell to perform brace expansion

You can see the complete list of set options which will be seen in the output of $- - The Set Builtin

Other options available in the interactive shell, -i to indicate to run the shell in interactive mode

  • -m to allow Job control
  • -H to enable ! style history substitution
Source Link
Inian
  • 13.1k
  • 2
  • 42
  • 55

Because when you run a script, the parent shell (the one you run your commands from) starts a non-interactive shell to run your script which has interactive flag disabled i and only turns on two options

  • -h to locate and remember (hash) commands as they are looked up for execution.
  • -B to allow the shell to perform brace expansion

You can see the complete list of set options which will be seen in the output of $- - The Set Builtin