Free Space
In this challenge, you are provided with a script that is designed to display the names of any file-systems which have less than a specified percentage of free space available.
Tasks
You need to complete the following task:
- Modify the script to display all file-systems present in the system
- Enhance the script to print file-systems that have less than the specified percentage of memory remaining
Requirements
You must meet the following requirements:
- The script should be named
freeSpace.sh
- Work directory should be
~/project
- Familiarity with
df
, tr
, cut
, working with arrays and loops is required
- The script should prompt the user to enter the usage percentage
Example
Example 1:
labex:project/ $ bash freeSpace.sh
[INPUT] Enter the usage [INPUT]
12
file system "/dev/mapper/docker-252:3-1311728-cf1bc296802376b110e1ac0a19ed3ad263fc81be8ff146ddfbd4acc246b61682" has "62%" of freespace and used space of 38%
file system "/dev/vda3" has "54%" of freespace and used space of 46%
Example 2:
labex:project/ $ bash freeSpace.sh
[INPUT] Enter the usage [INPUT]
60
No file System has usage of 40% of freeSpace