Skip to content
Snippets Groups Projects
Commit a893ceb3 authored by alexis.dereeper_ird.fr's avatar alexis.dereeper_ird.fr
Browse files

Update bash-9-scripting.md

parent 24c4f583
No related branches found
No related tags found
No related merge requests found
Pipeline #39822 passed
...@@ -17,7 +17,14 @@ When it will come the time to write scripts, you will have to use it extensively ...@@ -17,7 +17,14 @@ When it will come the time to write scripts, you will have to use it extensively
!!! question "Write a bash script that allows to count the number of files contained in the directory `training_unix_basics`" !!! question "Write a bash script that allows to count the number of files contained in the directory `training_unix_basics`"
??? example "Click to show the solution"
```bash
#!/bin/bash
directory=/home/<user_name>/training_unix_basics
file_count=$(ls -1 "$directory" | wc -l)
echo $file_count
```
!!! question "Write a bash script that asks for a directory name and count the number of files contained" !!! question "Write a bash script that asks for a directory name and count the number of files contained"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment