I'm confused on how to get the data usage information into the variables to determine if the file size are acceptable. How do I make the variable and direct it to the rest of the script?
Write a script (called passwd_size.sh) that does these tasks:
- Find the size of the
/etc/passwdfile - If the size is greater than 2000 bytes, display a message that the file exceeds size, otherwise, display message that the file is within the size limit.
du -c "/etc/passwd"
num=0
if [ $num -gt 2000 ];
then
echo "File exceeds size limit."
fi
if [ $num -lt 2000 && -eq 2000 ];
then
echo "File is within size limit."
fi
Any help is greatly appreciated!!!