We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The iventoy.sh script is pretty handy, but rather than have it terminate if not being run as root, like this:
uid=$(id -u) if [ $uid -ne 0 ]; then echo "Please use sudo or run the script as root." exit 1 fi
I suggest doing this instead:
# Check if script is being run as root, and if not, # Call script with sudo and pass original arguments [[ $EUID -ne 0 ]] && exec sudo "$0" "$@"
This way, if you didn't run as root, the script call sudo to prompt you for the password and re-run itself with all your original arguments.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The iventoy.sh script is pretty handy, but rather than have it terminate if not being run as root, like this:
I suggest doing this instead:
This way, if you didn't run as root, the script call sudo to prompt you for the password and re-run itself with all your original arguments.
The text was updated successfully, but these errors were encountered: