Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # This function assumes file name
- # as a argument and if exists
- # truncate it content and show
- # success message
- # Example of usage:
- # clearLogFile "fileName.txt"
- function clearLogFile {
- if [ -e $1 ]
- then
- cat /dev/null > $1
- echo "Log file ${1} is cleared."
- else
- echo "File ${1} don't exists"
- fi
- }
Advertisement
Add Comment
Please, Sign In to add comment