diff --git a/site/pages/scripts/0-base-commands.html b/site/pages/scripts/0-base-commands.html index 6f91bb0..0f2a2a9 100644 --- a/site/pages/scripts/0-base-commands.html +++ b/site/pages/scripts/0-base-commands.html @@ -9,8 +9,8 @@ next-page: pages/scripts/1-variables.html ---
This command print as output its entire argument on the command-line.
- It could be used with variables, like in the following example:
+
This command prints its entire argument as output on the command-line.
+ It can be used with variables, like in the following example:
example="this is an example" @@ -22,10 +22,10 @@ echo $exampleCat
-This command prints the content of a certain file as an output on the +This command prints the content of a certain file as output on the command-line.
-As example, we could imagine a simple text file in nano named "Hello", which contains +For example, we could imagine a simple text file in nano named "Hello", which contains the line "Hello World".
So, our command example will look like this:
diff --git a/site/pages/scripts/1-variables.html b/site/pages/scripts/1-variables.html index 196e49c..83e2fe0 100644 --- a/site/pages/scripts/1-variables.html +++ b/site/pages/scripts/1-variables.html @@ -10,13 +10,13 @@ next-page: pages/scripts/2-special-variables.html --- A variable is simply a string to which we assign a certain type of data, -which could be a text, a number, a filename and other types of data.
+which could be some text, a number, a filename or other types of data.
Naming a variable
-To name a variable in Unix we have to use only letters, numbers or +To name a variable in Unix we can only use letters, numbers or the underscore character (_).
Other characters can't be used because they have a special meaning in Unix Shell.
@@ -32,7 +32,7 @@ name_4Defining a variable
-To define a certain variable, we could use the following basecase: +To define a certain variable, we use the following base case:variable_name=variable_value @@ -58,7 +58,7 @@ echo $VAR_1-If we try to delete the variable, shell will give us the following value: +If we try to delete the variable, the shell will give us the following error:Deleting a variable
-Deleting a variable means that shell will remove a certain variable from the list of +Deleting a variable means that the shell will remove a certain variable from the list of those that it tracks.
To delete a variable we use the following command: @@ -75,7 +75,7 @@ unset VAR_1Protecting variables
-To protect a certain variable, we can set them as read-only so that it can't be +To protect a certain variable, we can set it as read-only so that it can't be changed or deleted.
So, if we try to change the value of VAR_1, the result will be the following: @@ -86,7 +86,7 @@ VAR_1="Blueberry" VAR_1: This variable is read only.VAR_1="Strawberry" diff --git a/site/pages/scripts/2-special-variables.html b/site/pages/scripts/2-special-variables.html index 8bb7187..0dd3c30 100644 --- a/site/pages/scripts/2-special-variables.html +++ b/site/pages/scripts/2-special-variables.html @@ -9,12 +9,12 @@ previous-page: pages/scripts/1-variables.html next-page: pages/scripts/3-parameter_expansion.html --- -There are certain strings that we can not use in the variable-naming process.
-In this page we will see what actually are those strings, and what's their purpose.
+There are certain strings that we can't use in the variable-naming process.
+In this page we will see what those strings are, and what their purpose is.
$$
-To begin, we will see the simplest variable, which is the dollar sign ($). -This command simply gives us the process ID number of the current shell.
+To begin, we look at the simplest variable, which is the dollar sign ($). +This command simply gives us the process ID of the current shell.
echo $$ @@ -22,7 +22,7 @@ echo $$$0
-This variable will simply give us the filename of the current script. +This variable simply gives us the filename of the current script.$n
This variable corresponds to the arguments with which a script was invoked. @@ -32,4 +32,4 @@ Here n is a positive number corresponding to the position of an argument. This variable gives us the number of arguments supplied to a script.$!
-This variable gives us the process number of the last background command. +This variable gives us the process ID of the last background command. diff --git a/site/pages/scripts/5-for-loop.html b/site/pages/scripts/5-for-loop.html index 20ea638..1109d78 100644 --- a/site/pages/scripts/5-for-loop.html +++ b/site/pages/scripts/5-for-loop.html @@ -60,7 +60,7 @@ There are also other ways to specify the numerical range . For instance, your numerical range is too big, you can simply write:{1..100}
. This piece of code means every natural number between 1 and 100 (both included).
Ranges can also count backward like this:{10..1}
. -You can even increment the numerical value by step of two:{0..10..2}
. -This piece of code means every natural number between 0 and 10 with a step of two, +You can even increment the numerical value by steps of two:{0..10..2}
. +This piece of code means every natural number between 0 and 10 in steps of two; 0 2 4 6... 10. diff --git a/site/pages/scripts/6-while-loop.html b/site/pages/scripts/6-while-loop.html index c0f3f47..00e47a5 100644 --- a/site/pages/scripts/6-while-loop.html +++ b/site/pages/scripts/6-while-loop.html @@ -31,7 +31,7 @@ done -Here is a first simple example: +Here is a simple first example: {% highlight bash %} i=0; @@ -80,8 +80,8 @@ do done {% endhighlight %} -No termination condition is set for this loop in this example. This type of loop -is called infinite loop.
+No termination condition is set for the loop in this example. This type of loop +is called an infinite loop.
Theexit
statement is used to quit the loop. This loop will iterate for 9 times, then as soon asi
becomes equal to 0, the condition of the last if diff --git a/site/pages/scripts/7-if.html b/site/pages/scripts/7-if.html index 2639c50..d27a5a1 100644 --- a/site/pages/scripts/7-if.html +++ b/site/pages/scripts/7-if.html @@ -11,7 +11,7 @@ next-page: pages/scripts/8-redirection.html If statements allow us to make decisions in our Bash scripts. They allow us to -whether run or not a piece of code based on a condition that we set.
+decide whether or not to run a piece of code based on a condition that we set.
If statements take this form: {% highlight bash %} @@ -39,7 +39,7 @@ In this first example we evaluate a variablei
to 105. The if statement will print "You chose a big number" only if the number contained in our variablei
is Greater or Equal to 200.
-This is our case, therefore the output of this piece of code will be: +This is the case, therefore the output of this piece of code will be:You chose a big number.@@ -52,7 +52,7 @@ This is our case, therefore the output of this piece of code will be: Sometimes we want to perform a certain set of actions, if our condition evaluates to true and another set of actions if our condition evaluates to false. We can do this with the if else statement. - if else sattements take this form: + if else statements take this form: {% highlight bash %} if [condition]; then command1 @@ -78,10 +78,10 @@ else fi {% endhighlight %} -In this example, that is just an extension of the previous example, we +In this example, which is just an extension of the previous example, we evaluate a variablei
to 50. Ifi
is greater or equal to -200, you print out "You chose a big number", otherwise, -(ifi
is not greater or equal to 200), just like in this case, you print out +200, we print out "You chose a big number", otherwise, +(ifi
is not greater or equal to 200), just like in this case, we print out "You chose a small number". Therefore, the output of this piece of code is: @@ -130,7 +130,7 @@ else fi {% endhighlight %} -In this example, that is just an extension of the previous example, we evaluate a +In this example, which is just an extension of the previous example, we evaluate a variablei
to 150. Ifi
is greater or equal to 200, you print out "You chose a big number", ifi
is equal to 150 you print out "You chose 150" otherwise you print out "You chose a small number". diff --git a/site/pages/scripts/8-redirection.html b/site/pages/scripts/8-redirection.html index ef4d7c8..4b92cda 100644 --- a/site/pages/scripts/8-redirection.html +++ b/site/pages/scripts/8-redirection.html @@ -9,7 +9,7 @@ previous-page: pages/scripts/7-if.html ---output as input
-To redirect a certain output of the command-line we have to use the symbol ">".
+To redirect the output of a command we use the symbol ">".
In this case, we will use a file named hello.txt, in which we want to insert a certain output ("Sun" in this case):
@@ -40,10 +40,10 @@ cat hello.txtinput as output
-To redirect an input from a file for a command, the symbol "<" is used. +To redirect input from a file for a command, the symbol "<" is used.-echo $lt; $(cat hello.txt) +echo < $(cat hello.txt) Sun Moon@@ -54,7 +54,7 @@ This is particularly useful when chaining commands.
Chaining (or piping)
Chaining, also called Piping because it works with the pipe symbol "|", takes -the output of a certain command-line and feeds it to another command in a direct way. +the output of a certain command and feeds it to another command.cat hello.txt | grep Mo Moon @@ -63,7 +63,7 @@ MoonA simple example
Now let's say that we want to combine those commands in a more complex operation. -Let's say we want to take some contents from a certain file and put it into another file.
+Let's say we want to take the content of a certain file and put it into another file.
We want to sort the animals whose name begins with letter "d" from the file animals.txt and put it into d_animals.txt.