Mount Challenge
In this challenge, you are required to write a script to determine whether a given file system or mount point is mounted. You will need to check if the file system is mounted, print the free space available if it is, and provide an error message if it is not.
Tasks
You need to complete the following task:
- Check if the given file system is mounted or not.
- If it's mounted, print the free space available in it.
- Otherwise, print an error message.
Requirements
You must meet the following requirements:
- Must use commands
df
, tr
, and cut
.
- Utilize arrays and loops.
- The script should be named
mount.sh
.
- The working directory should be
~/project
.
Example
Sample Execution / Output:
labex:project/ $ bash mount.sh /dev/vda3
Filesystem /dev/vda3 is 46% used with 21367676 KB free.
Note: /dev/vda3
is for example only. You should be able to use the available file system or mount point.