Skip to content

Instantly share code, notes, and snippets.

@xiangzhuyuan
Created June 29, 2017 04:44
Show Gist options
  • Save xiangzhuyuan/48f6cd875048fafe28803200926e0b1a to your computer and use it in GitHub Desktop.
Save xiangzhuyuan/48f6cd875048fafe28803200926e0b1a to your computer and use it in GitHub Desktop.
check file exist or empty
#!/usr/bin/env bash
pidFile=~/test1
if [ ! -s ${pidFile} ];then
echo 'not exist or empty, touch this file'
touch ${pidFile}
fi
cat $pidFile
cat $pidFile|wc -l
ls -alht $pidFile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment