Last active
December 23, 2020 19:00
-
-
Save goyuninfo/327fb920304f3905c0a320cbba84770a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
_file="$1" | |
[ $# -eq 0 ] && { echo "Usage: $0 filename"; exit 1; } | |
[ ! -f "$_file" ] && { echo "Error: $0 file not found."; exit 2; } | |
if [ -s "$_file" ] | |
then | |
echo "$_file has some data." | |
# do something as file has data | |
else | |
echo "$_file is empty." | |
# do something as file is empty | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment