Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

Difference between commands in bash script and commands in terminal

Are there any differences between commands that you type into the terminal and commands you include in a script?
by

1 Answer

Amit8z4mc
In general, the answer would be "no", commands in shell are the same in scripts, in syntax and semantics.

But there is a bunch of small nuances related to configuration of environment (what variables are used and to what they are set).

the interactive shell of choice for Linux is bash, but scripting often uses other interpreters (sh, which is a predecessor of bash, ksh, which is on par with bash), so you have to take into account what shell is used (the current shell s name is traditionally held in variable SHELL, try typing echo $SHELL).

there may be differences in configuration of the same interpreter for interactive session and for script execution.

Login / Signup to Answer the Question.