From cc943c6e89f58a10b0b3fde999d3cff109ff2e81 Mon Sep 17 00:00:00 2001 From: "alexis.dereeper_ird.fr" <alexis.dereeper@ird.fr> Date: Sat, 23 Nov 2024 16:50:51 +0000 Subject: [PATCH] Update bash-9-scripting.md --- docs/pages/bash/bash-9-scripting.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/pages/bash/bash-9-scripting.md b/docs/pages/bash/bash-9-scripting.md index a925ee7..49a7d9c 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" -- GitLab