Fix grammar and which user executes example (#25897)

I clarified the writing and added some missing articles ("the"). I also changed the description to state that the root user is running the command, based on the use of "sudo" and 744 permissions.
pull/31311/head^2
almande 2019-01-26 18:44:50 -05:00 committed by Jonathan Grah
parent a948c416d4
commit 06a2d163f7
1 changed files with 4 additions and 4 deletions

View File

@ -43,17 +43,17 @@ It's worth noting that the first line of the script starts with `#!`. It is a sp
That is because it is a convention to let the interactive shell know what kind of interpreter to run for the program that follows. The first line tells Unix that the file is to be executed by /bin/bash. This is the standard location of the Bourne shell on just about every Unix system. Adding #!/bin/bash as the first line of your script tells the OS to invoke the specified shell to execute the commands that follow in the script.
`#!` is often referred to as a "hash-bang", "she-bang" or "sha-bang".
Though it is only executed if you run your script as an executable. For example, when you type `./scriptname.extension`, it will look at the top line to find out the interpreter, whereas, running the script as `bash scriptname.sh`, the first line is ignored.
Then you could run the script like so:
For make file executable you should call this command under sudo chmod +x "filename".
For example, you can use this method to run the script as the root user:
To make the file executable call this command under sudo chmod +x "filename".
```
zach@marigold:~$ ./myBashScript.sh
Hello world!
```
The script only has two lines. The first indicates what interpreter to use to run the file (in this case, bash). The second line is the command we want to use, echo, followed by what we want to print which is "Hello World".
The script only has two lines. The first line indicates what interpreter to use to run the file (in this case, bash). The second line is the command we want to use, echo, followed by what we want to print which is "Hello World".
Sometimes the script won't be executed, and the above command will return an error. This is due to the permissions set on the file. To avoid that use:
```