This should be a easy question. I'm new to bash-scripting, but I want to play with it a bit.
I've made a script that can download a big file, and shutdown the computer afterwards, but to make it bulletproof, I want to check if the user wrote sudo in front of it, or else I cant shutdown the computer.
I already check to see if a file has been specified, but still I need to see if the script has the right privileges, and if not only print usage-message.Code:#!/bin/bash if [[ $1 != "" ]] then wget -c "$1"; sudo shutdown -k 0; else echo "Usage: sudo ./downloadAndShutdown <fileToDownload>"; fi
Ebbe



Adv Reply





Bookmarks