Skip to content

Instantly share code, notes, and snippets.

@professorjamesmoriarty
Created April 25, 2013 20:00
Show Gist options
  • Select an option

  • Save professorjamesmoriarty/5462663 to your computer and use it in GitHub Desktop.

Select an option

Save professorjamesmoriarty/5462663 to your computer and use it in GitHub Desktop.
#!/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 "new msg"
# do Someonething as file has data
else
echo "nothing"
# 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