diff options
author | Luca Bruno <lucab@debian.org> | 2010-05-16 15:11:12 +0200 |
---|---|---|
committer | Luca Bruno <lucab@debian.org> | 2010-05-16 15:11:12 +0200 |
commit | 3f33558e48612004b70d0b726f7e5651b6f67ea1 (patch) | |
tree | ae70067e2d7c4c2de8ea7b956460a18c197d8cae /examples/data/scripts | |
parent | 6a06bd6706092ccf300fda02726c2066b03721c8 (diff) |
Avoid bash specific syntax in helpers
Most of our helpers don't really depend on bash, and work just fine
with every system shell.
Thus, let's avoid "bashisms" in there to accomodate more bare-bone
shells (like dash, see https://wiki.ubuntu.com/DashAsBinSh )
Signed-off-by: Luca Bruno <lucab@debian.org>
Diffstat (limited to 'examples/data/scripts')
-rwxr-xr-x | examples/data/scripts/formfiller.sh | 5 | ||||
-rwxr-xr-x | examples/data/scripts/insert_bookmark.sh | 4 | ||||
-rwxr-xr-x | examples/data/scripts/instance-select-wmii.sh | 8 |
3 files changed, 9 insertions, 8 deletions
diff --git a/examples/data/scripts/formfiller.sh b/examples/data/scripts/formfiller.sh index 69eca17..deccea2 100755 --- a/examples/data/scripts/formfiller.sh +++ b/examples/data/scripts/formfiller.sh @@ -51,6 +51,7 @@ else fi PROMPT="Choose profile" +RAND=$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -c 1-5) MODELINE="> vim:ft=formfiller" keydir=${XDG_DATA_HOME:-$HOME/.local/share}/uzbl/dforms @@ -159,7 +160,7 @@ then 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}"` + option=`printf "$menu"| dmenu ${LINES} -nb "${NB}" -nf "${NF}" -sb "${SB}" -sf "${SF}" -p "${PROMPT}"` fi # Remove comments @@ -210,7 +211,7 @@ else if [ "$action" = 'new' -o "$action" = 'add' ] then [ "$action" = 'new' ] && echo "$MODELINE" > $keydir/$domain - echo "!profile=NAME_THIS_PROFILE$RANDOM" >> $keydir/$domain + echo "!profile=NAME_THIS_PROFILE$RAND" >> $keydir/$domain # # 2. and 3. line (tr -d and sed) are because, on gmail login for example, # <input > tag is splited into lines diff --git a/examples/data/scripts/insert_bookmark.sh b/examples/data/scripts/insert_bookmark.sh index d0ec84e..2ec5975 100755 --- a/examples/data/scripts/insert_bookmark.sh +++ b/examples/data/scripts/insert_bookmark.sh @@ -3,7 +3,7 @@ [ -d "${XDG_DATA_HOME:-$HOME/.local/share}/uzbl" ] || exit 1 file=${XDG_DATA_HOME:-$HOME/.local/share}/uzbl/bookmarks -which zenity &>/dev/null || exit 2 +which zenity 2>&1 >/dev/null || exit 2 url=$6 # replace tabs, they are pointless in titles and we want to use tabs as delimiter. title=$(echo "$7" | sed 's/\t/ /') @@ -14,5 +14,5 @@ url=`echo $entry | awk '{print $1}'` # TODO: check if already exists, if so, and tags are different: ask if you want to replace tags echo "$entry" >/dev/null #for some reason we need this.. don't ask me why -echo -e "$entry" >> $file +printf "$entry\n" >> $file true diff --git a/examples/data/scripts/instance-select-wmii.sh b/examples/data/scripts/instance-select-wmii.sh index fdd27e6..64b859e 100755 --- a/examples/data/scripts/instance-select-wmii.sh +++ b/examples/data/scripts/instance-select-wmii.sh @@ -20,7 +20,7 @@ else DMENU="dmenu -i" fi -if [ "$1" == 'list' ] +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 @@ -29,9 +29,9 @@ then label=$(wmiir read /client/$i/label) list="$list$i : $label\n" done - window=$(echo -e "$list" | $DMENU $COLORS | cut -d ' ' -f1) + window=$(printf "$list\n" | $DMENU $COLORS | cut -d ' ' -f1) wmiir xwrite /tag/sel/ctl "select client $window" -elif [ "$1" == 'next' ] +elif [ "$1" = 'next' ] then current=$(wmiir read /client/sel/ctl | head -n 1) # find the next uzbl window and focus it @@ -40,7 +40,7 @@ then then wmiir xwrite /tag/sel/ctl "select client $next" fi -elif [ "$1" == 'prev' ] +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) |