From b9cc0b3e0a9ed7f5ce1181e94cf813544011547e Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sat, 21 Aug 2010 10:07:26 -0400 Subject: Put `then' on the same line as `if' --- examples/data/scripts/download.sh | 3 +-- examples/data/scripts/formfiller.sh | 21 +++++++-------------- examples/data/scripts/instance-select-wmii.sh | 21 +++++++-------------- examples/data/scripts/load_url_from_bookmarks.sh | 3 +-- examples/data/scripts/load_url_from_history.sh | 3 +-- 5 files changed, 17 insertions(+), 34 deletions(-) (limited to 'examples/data') diff --git a/examples/data/scripts/download.sh b/examples/data/scripts/download.sh index f6d34e9..0f051db 100755 --- a/examples/data/scripts/download.sh +++ b/examples/data/scripts/download.sh @@ -14,8 +14,7 @@ export http_proxy test "x$url" = "x" && { echo "you must supply a url! ($url)"; exit 1; } # only changes the dir for the $get sub process -if echo "$url" | grep -E '.*\.torrent' >/dev/null; -then +if echo "$url" | grep -E '.*\.torrent' >/dev/null; then ( cd "$dest"; $GET "$url") else ( cd "$dest"; $GET "$url") diff --git a/examples/data/scripts/formfiller.sh b/examples/data/scripts/formfiller.sh index 69eca17..2801262 100755 --- a/examples/data/scripts/formfiller.sh +++ b/examples/data/scripts/formfiller.sh @@ -43,8 +43,7 @@ NF="#4e7093" SB="#003d7c" SF="#3a9bff" -if [ "`dmenu --help 2>&1| grep lines`x" != "x" ] -then +if [ "`dmenu --help 2>&1| grep lines`x" != "x" ]; then LINES=" -l 3 " else LINES="" @@ -87,12 +86,10 @@ action=$1 domain=$(echo $url | sed 's/\(http\|https\):\/\/\([^\/]\+\)\/.*/\2/') -if [ "$action" != 'edit' -a "$action" != 'new' -a "$action" != 'load' -a "$action" != 'add' -a "$action" != 'once' ] -then +if [ "$action" != 'edit' -a "$action" != 'new' -a "$action" != 'load' -a "$action" != 'add' -a "$action" != 'once' ]; then action="new" [ -e "$keydir/$domain" ] && action="load" -elif [ "$action" = 'edit' ] && [ ! -e "$keydir/$domain" ] -then +elif [ "$action" = 'edit' ] && [ ! -e "$keydir/$domain" ]; then action="new" fi @@ -152,11 +149,9 @@ insertFunction="function insert(fname, ftype, fvalue, fchecked) { \ } \ }; " -if [ "$action" = 'load' ] -then +if [ "$action" = 'load' ]; then [ -e $keydir/$domain ] || exit 2 - if [ `cat $keydir/$domain|grep "!profile"|wc -l` -gt 1 ] - then + if [ `cat $keydir/$domain|grep "!profile"|wc -l` -gt 1 ]; then menu=`cat $keydir/$domain| \ sed -n 's/^!profile=\([^[:blank:]]\+\)/\1/p'` option=`echo -e -n "$menu"| dmenu ${LINES} -nb "${NB}" -nf "${NF}" -sb "${SB}" -sf "${SF}" -p "${PROMPT}"` @@ -179,8 +174,7 @@ then printf '%s\n' "${fields}" | \ sed -n -e "s/\([^{]\+\){\([^}]*\)}(\(radio\|checkbox\)):[ ]*\(.\+\)/js $insertFunction; insert('\1', '\3', '\2', \4);/p" | \ sed -e 's/@/\\@/g' > $fifo -elif [ "$action" = "once" ] -then +elif [ "$action" = "once" ]; then tmpfile=`mktemp` printf 'js %s dump(); \n' "$dumpFunction" | \ socat - unix-connect:$socket | \ @@ -207,8 +201,7 @@ then sed -e 's/@/\\@/g' > $fifo rm -f $tmpfile else - if [ "$action" = 'new' -o "$action" = 'add' ] - then + if [ "$action" = 'new' -o "$action" = 'add' ]; then [ "$action" = 'new' ] && echo "$MODELINE" > $keydir/$domain echo "!profile=NAME_THIS_PROFILE$RANDOM" >> $keydir/$domain # diff --git a/examples/data/scripts/instance-select-wmii.sh b/examples/data/scripts/instance-select-wmii.sh index fdd27e6..1340351 100755 --- a/examples/data/scripts/instance-select-wmii.sh +++ b/examples/data/scripts/instance-select-wmii.sh @@ -13,39 +13,32 @@ COLORS=" -nb #303030 -nf khaki -sb #CCFFAA -sf #303030" -if dmenu --help 2>&1 | grep -q '\[-rs\] \[-ni\] \[-nl\] \[-xs\]' -then +if dmenu --help 2>&1 | grep -q '\[-rs\] \[-ni\] \[-nl\] \[-xs\]'; then DMENU="dmenu -i -xs -rs -l 10" # vertical patch else DMENU="dmenu -i" fi -if [ "$1" == 'list' ] -then +if [ "$1" == 'list' ]; then list= # get window id's of uzbl clients. we could also get the label in one shot but it's pretty tricky - for i in $(wmiir read /tag/sel/index | grep uzbl |cut -d ' ' -f2) - do + for i in $(wmiir read /tag/sel/index | grep uzbl |cut -d ' ' -f2); do label=$(wmiir read /client/$i/label) list="$list$i : $label\n" done window=$(echo -e "$list" | $DMENU $COLORS | cut -d ' ' -f1) wmiir xwrite /tag/sel/ctl "select client $window" -elif [ "$1" == 'next' ] -then +elif [ "$1" == 'next' ]; then current=$(wmiir read /client/sel/ctl | head -n 1) # find the next uzbl window and focus it next=$(wmiir read /tag/sel/index | grep -A 10000 " $current " | grep -m 1 uzbl | cut -d ' ' -f2) - if [ x"$next" != "x" ] - then + if [ x"$next" != "x" ]; then wmiir xwrite /tag/sel/ctl "select client $next" fi -elif [ "$1" == 'prev' ] -then +elif [ "$1" == 'prev' ]; then current=$(wmiir read /client/sel/ctl | head -n 1) prev=$(wmiir read /tag/sel/index | grep -B 10000 " $current " | tac | grep -m 1 uzbl | cut -d ' ' -f2) - if [ x"$prev" != "x" ] - then + if [ x"$prev" != "x" ]; then wmiir xwrite /tag/sel/ctl "select client $prev" fi else diff --git a/examples/data/scripts/load_url_from_bookmarks.sh b/examples/data/scripts/load_url_from_bookmarks.sh index 1e9f9e7..569f2bf 100755 --- a/examples/data/scripts/load_url_from_bookmarks.sh +++ b/examples/data/scripts/load_url_from_bookmarks.sh @@ -5,8 +5,7 @@ file=${XDG_DATA_HOME:-$HOME/.local/share}/uzbl/bookmarks [ -r "$file" ] || exit COLORS=" -nb #303030 -nf khaki -sb #CCFFAA -sf #303030" -if dmenu --help 2>&1 | grep -q '\[-rs\] \[-ni\] \[-nl\] \[-xs\]' -then +if dmenu --help 2>&1 | grep -q '\[-rs\] \[-ni\] \[-nl\] \[-xs\]'; then DMENU="dmenu -i -xs -rs -l 10" # vertical patch # show tags as well goto=`$DMENU $COLORS < $file | awk '{print $1}'` diff --git a/examples/data/scripts/load_url_from_history.sh b/examples/data/scripts/load_url_from_history.sh index 62e02ac..bec6258 100755 --- a/examples/data/scripts/load_url_from_history.sh +++ b/examples/data/scripts/load_url_from_history.sh @@ -6,8 +6,7 @@ history_file=${XDG_DATA_HOME:-$HOME/.local/share}/uzbl/history # choose from all entries, sorted and uniqued # goto=`awk '{print $3}' $history_file | sort -u | dmenu -i` COLORS=" -nb #303030 -nf khaki -sb #CCFFAA -sf #303030" -if dmenu --help 2>&1 | grep -q '\[-rs\] \[-ni\] \[-nl\] \[-xs\]'; -then +if dmenu --help 2>&1 | grep -q '\[-rs\] \[-ni\] \[-nl\] \[-xs\]'; then DMENU="dmenu -i -xs -rs -l 10" # vertical patch # choose an item in reverse order, showing also the date and page titles # pick the last field from the first 3 fields. this way you can pick a url (prefixed with date & time) or type just a new url. -- cgit v1.2.3