Monthly Archives: November 2010

sudo without a password

Note, this is not something I recommend doing. In fact, the only reason why I’m documenting it is that I am removing this solution from the last box I used to have it on. Anyway, edit the /etc/sudoers file (with visudo, as root), then add lines under the default one for root, like this: # […]

Using Flags and Arguments in Bash

Here’s a simple example script, showing how to deal with different inputs depending on the flag preceding them: #!/bin/bash USAGE=”Usage: Enter a noun after either -p (polite) or -i (insulting).” while getopts “:p:i:” OPTIONS; do case $OPTIONS in p ) polite=$OPTARG;; i ) insulting=$OPTARG;; h ) echo $USAGE;; \? ) echo $USAGE exit 1;; * […]