diff --git a/docs/pages/bash/bash-9-scripting.md b/docs/pages/bash/bash-9-scripting.md index a925ee7c666b90fd07c5bc48549d969bd4f5bf41..49a7d9caf4c4d496c686717ae0473486c46c3f0f 100644 --- a/docs/pages/bash/bash-9-scripting.md +++ b/docs/pages/bash/bash-9-scripting.md @@ -39,12 +39,15 @@ When it will come the time to write scripts, you will have to use it extensively ./count.sh ``` +## Read the standard input + `read` is a bash built-in command that reads a line from the standard input (or from the file descriptor) and split the line into words. The first word is assigned to the first variable, the second one to the second variable, and so on. ```bash read var1 var2 Hello world -echo $var1echo $var2 +echo $var1 +echo $var2 ``` !!! question "Write a bash script called `count2.sh` that asks for a directory name and count the number of files contained" @@ -64,7 +67,7 @@ echo $var1echo $var2 echo $file_count ``` -## First script with argument +## Script with argument !!! question "Write a bash script called `count3.sh` that takes as an argument a directory name and count the number of files contained, after checking that the directory exists"