Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Sample Script Template for Bash and Shell Script
- trap finish 0
- trap cleanup 1 2 3 6
- function checksudocommand()
- {
- if [ $(id -u) -ne 0 ];
- then
- echo -e "\nYou must run this script as root. You are able to use the sudo command.\n"
- exit 1
- fi
- }
- function cleanup()
- {
- echo "Caught Signal ... cleaning up."
- echo "Done cleanup ... quitting."
- exit 1
- }
- function finish()
- {
- # comment with code
- # script
- exit 0
- }
- function main()
- {
- echo -e "\nHello, World!\n"
- }
- function usage()
- {
- grep '^#/' "$0" | cut -c4-
- exit 0
- }
- expr "$*" : ".*--help" > /dev/null && usage
- #### Main Program ####
- checksudocommand
- main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement