Skip to content

Instantly share code, notes, and snippets.

@odadoda
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save odadoda/9410670 to your computer and use it in GitHub Desktop.
Save odadoda/9410670 to your computer and use it in GitHub Desktop.
check file
# check if param 1 is not empty and if the file exists
if [ -z $1 ] ; then
echo "Param 1 missing. Must have a file to present."
exit
else
FILE="$1"
fi
if [ ! -f $FILE ] ; then
echo "File not found."
exit
fi
# count lines
file_lines_count=`cat $FILE | wc -l `;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment