From ac11b805e42d705e75fd8f0df8e00544ae54735c Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 14 Sep 2013 17:20:47 +1200 Subject: Do away with getopts completely, just use arg --- psshd | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) (limited to 'psshd') diff --git a/psshd b/psshd index 22261f1..1a86c9d 100755 --- a/psshd +++ b/psshd @@ -4,11 +4,10 @@ # Wrapper around autossh and start-stop-daemon for basic persistence. Intended # to be called as a script from profile.d for automatic SSH tunnels. # -# Takes one required option -p, the autossh monitoring port number to use. Cut -# the options off with -- and the remainder of the arguments are passed to the -# autossh binary. +# Uses one argument, the autossh monitoring port number to use. The remainder +# of the arguments are passed to the autossh binary. # -# $ psshd -p 9001 -- -fN -D 8001 remotehost +# $ psshd 9001 -fN -D 8001 remotehost # # @author Tom Ryder # @copyright 2013 @@ -29,27 +28,12 @@ for cmd in "${cmds[@]}"; do fi done -# Get port in options -while getopts :p: opt; do - case $opt in - p) - port=$OPTARG - ;; - \?) - printf '%s - Invalid option %s\n' "$self" "$OPTARG" >&2 - exit 1 - ;; - :) - printf '%s - Option -%s requires an argument\n' "$self" "$OPTARG" >&2 - exit 1 - ;; - esac -done -shift $((OPTIND-1)) - # If no port, give up with usage instructions -if ! [[ $port ]]; then - printf 'USAGE: %s -p -- \n' "$self" +if (($# > 0)); then + port=$1 + shift +else + printf 'USAGE: %s -- \n' "$self" exit 1 fi -- cgit v1.2.3 56f40c49a'>commitdiff
blob: 617a9b43babed3a92b2fcaf6c6820533ac55adb1 (plain) (tree)
1
2
3


                                                                 
# Apply a random background image. Requires rndf(1df) and feh(1).
bg=$(rndf "${XBACKGROUNDS:-"$HOME"/.xbackgrounds}") || exit
feh --bg-scale --no-fehbg -- "$bg"