mirror of
https://github.com/bregman-arie/devops-exercises.git
synced 2024-11-24 08:22:12 +02:00
ANSWERED: Write a script to remove all the empty files in a given dir.
This commit is contained in:
parent
accce12933
commit
6c4f32af1b
16
README.md
16
README.md
@ -4800,6 +4800,7 @@ Using the keyword <code>read</code> so for example <code>read x</code> will wait
|
||||
<details>
|
||||
<summary>Write a script to determine whether a host is up or down</summary><br><b>
|
||||
|
||||
**EXAMPLE ONE**
|
||||
```
|
||||
#!/bin/bash
|
||||
SERVERIP=<IP Address>
|
||||
@ -4817,6 +4818,21 @@ fi
|
||||
|
||||
<details>
|
||||
<summary>Write a script to remove all the empty files in a given directory (also nested directories)</summary><br><b>
|
||||
|
||||
**EXAMPLE ONE**
|
||||
```
|
||||
#! /bin/bash
|
||||
for x in *
|
||||
do
|
||||
if [ -s $x ]
|
||||
then
|
||||
continue
|
||||
else
|
||||
rm -rf $x
|
||||
fi
|
||||
done
|
||||
```
|
||||
|
||||
</b></details>
|
||||
|
||||
<a name="shell-scripting-advanced"></a>
|
||||
|
Loading…
Reference in New Issue
Block a user