Distinguish between the three ways to run a shell script.
- We have been running shell scripts by typing in the name of the script at the command line.
- There are two other techniques you can use to run a shell script.
- Each technique has an advantage and is appropriate in specific circumstances.
- The chart below lists three techniques used to run the script called myscript and the file permissions and process relationships used by the technique
- Would it be possible and appropriate to give these techniques names instead of just numbers?
- It seems it would make them easier to refer to in the text.
- Could they be called something like "script name," "shell path," and the 'dot command"
Can you think of anything?
Or do you think we should just keep the numbers?
The numbers are alright for talking about this in this lesson, but may be confusing if we refer to these techniques in other places.
More confusing if you do not have this table right in front of you.
Technique number | Command | permissions | Subprocess created? |
1 | Myscript | r-x | Yes--runs as a child process of the current shell |
2 | /bin/sh myscript | r-- | Yes--runs as a child process of the current shell |
3 | . myscript | r-- | No--runs inside the current shell |