From 1c8635db3838f613e400a5ef8897f7853e260276 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sat, 21 Aug 2010 10:09:09 -0400 Subject: Use $() over `` --- examples/data/scripts/formfiller.sh | 22 +++++++++++----------- examples/data/scripts/history.sh | 4 ++-- examples/data/scripts/insert_bookmark.sh | 4 ++-- examples/data/scripts/load_url_from_bookmarks.sh | 4 ++-- examples/data/scripts/load_url_from_history.sh | 10 +++++----- examples/data/scripts/session.sh | 2 +- 6 files changed, 23 insertions(+), 23 deletions(-) (limited to 'examples/data/scripts') diff --git a/examples/data/scripts/formfiller.sh b/examples/data/scripts/formfiller.sh index 2801262..564bf82 100755 --- a/examples/data/scripts/formfiller.sh +++ b/examples/data/scripts/formfiller.sh @@ -43,7 +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="" @@ -54,7 +54,7 @@ MODELINE="> vim:ft=formfiller" keydir=${XDG_DATA_HOME:-$HOME/.local/share}/uzbl/dforms -[ -d "`dirname $keydir`" ] || exit 1 +[ -d "$(dirname $keydir)" ] || exit 1 [ -d "$keydir" ] || mkdir "$keydir" editor="${VISUAL}" @@ -151,23 +151,23 @@ insertFunction="function insert(fname, ftype, fvalue, fchecked) { \ if [ "$action" = 'load' ]; then [ -e $keydir/$domain ] || exit 2 - 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}"` + 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}") fi # Remove comments sed '/^>/d' -i $tmpfile sed 's/^\([^{]\+\){\([^}]*\)}(\(radio\|checkbox\)):\(off\|no\|false\|unchecked\|0\|$\)/\1{\2}(\3):0/I;s/^\([^{]\+\){\([^}]*\)}(\(radio\|checkbox\)):[^0]\+/\1{\2}(\3):1/I' -i $keydir/$domain - fields=`cat $keydir/$domain | \ + fields=$(cat $keydir/$domain | \ sed -n "/^!profile=${option}/,/^!profile=/p" | \ sed '/^!profile=/d' | \ sed 's/^\([^(]\+(\)\(radio\|checkbox\|text\|search\|textarea\|password\)):/%{>\1\2):<}%/' | \ sed 's/^\(.\+\)$/<{br}>\1/' | \ tr -d '\n' | \ - sed 's/<{br}>%{>\([^(]\+(\)\(radio\|checkbox\|text\|search\|textarea\|password\)):<}%/\\n\1\2):/g'` + sed 's/<{br}>%{>\([^(]\+(\)\(radio\|checkbox\|text\|search\|textarea\|password\)):<}%/\\n\1\2):/g') printf '%s\n' "${fields}" | \ sed -n -e "s/\([^(]\+\)(\(password\|text\|search\|textarea\)\+):[ ]*\(.\+\)/js $insertFunction; insert('\1', '\2', '\3', 0);/p" | \ sed -e 's/@/\\@/g;s/<{br}>/\\\\n/g' > $fifo @@ -175,7 +175,7 @@ if [ "$action" = 'load' ]; then sed -n -e "s/\([^{]\+\){\([^}]*\)}(\(radio\|checkbox\)):[ ]*\(.\+\)/js $insertFunction; insert('\1', '\3', '\2', \4);/p" | \ sed -e 's/@/\\@/g' > $fifo elif [ "$action" = "once" ]; then - tmpfile=`mktemp` + tmpfile=$(mktemp) printf 'js %s dump(); \n' "$dumpFunction" | \ socat - unix-connect:$socket | \ sed -n '/^[^(]\+([^)]\+):/p' > $tmpfile @@ -188,11 +188,11 @@ elif [ "$action" = "once" ]; then sed '/^>/d' -i $tmpfile sed 's/^\([^{]\+\){\([^}]*\)}(\(radio\|checkbox\)):\(off\|no\|false\|unchecked\|0\|$\)/\1{\2}(\3):0/I;s/^\([^{]\+\){\([^}]*\)}(\(radio\|checkbox\)):[^0]\+/\1{\2}(\3):1/I' -i $tmpfile - fields=`cat $tmpfile | \ + fields=$(cat $tmpfile | \ sed 's/^\([^(]\+(\)\(radio\|checkbox\|text\|search\|textarea\|password\)):/%{>\1\2):<}%/' | \ sed 's/^\(.\+\)$/<{br}>\1/' | \ tr -d '\n' | \ - sed 's/<{br}>%{>\([^(]\+(\)\(radio\|checkbox\|text\|search\|textarea\|password\)):<}%/\\n\1\2):/g'` + sed 's/<{br}>%{>\([^(]\+(\)\(radio\|checkbox\|text\|search\|textarea\|password\)):<}%/\\n\1\2):/g') printf '%s\n' "${fields}" | \ sed -n -e "s/\([^(]\+\)(\(password\|text\|search\|textarea\)\+):[ ]*\(.\+\)/js $insertFunction; insert('\1', '\2', '\3', 0);/p" | \ sed -e 's/@/\\@/g;s/<{br}>/\\\\n/g' > $fifo diff --git a/examples/data/scripts/history.sh b/examples/data/scripts/history.sh index 7c83aa6..be5fd34 100755 --- a/examples/data/scripts/history.sh +++ b/examples/data/scripts/history.sh @@ -1,5 +1,5 @@ #!/bin/sh file=${XDG_DATA_HOME:-$HOME/.local/share}/uzbl/history -[ -d `dirname $file` ] || exit 1 -echo `date +'%Y-%m-%d %H:%M:%S'`" $6 $7" >> $file +[ -d $(dirname $file) ] || exit 1 +echo $(date +'%Y-%m-%d %H:%M:%S')" $6 $7" >> $file diff --git a/examples/data/scripts/insert_bookmark.sh b/examples/data/scripts/insert_bookmark.sh index d0ec84e..4d29ad6 100755 --- a/examples/data/scripts/insert_bookmark.sh +++ b/examples/data/scripts/insert_bookmark.sh @@ -7,10 +7,10 @@ which zenity &>/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/ /') -entry=`zenity --entry --text="Add bookmark. add tags after the '\t', separated by spaces" --entry-text="$url $title\t"` +entry=$(zenity --entry --text="Add bookmark. add tags after the '\t', separated by spaces" --entry-text="$url $title\t") exitstatus=$? if [ $exitstatus -ne 0 ]; then exit $exitstatus; fi -url=`echo $entry | awk '{print $1}'` +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 diff --git a/examples/data/scripts/load_url_from_bookmarks.sh b/examples/data/scripts/load_url_from_bookmarks.sh index 569f2bf..3134407 100755 --- a/examples/data/scripts/load_url_from_bookmarks.sh +++ b/examples/data/scripts/load_url_from_bookmarks.sh @@ -8,11 +8,11 @@ COLORS=" -nb #303030 -nf khaki -sb #CCFFAA -sf #303030" 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}'` + goto=$($DMENU $COLORS < $file | awk '{print $1}') else DMENU="dmenu -i" # because they are all after each other, just show the url, not their tags. - goto=`awk '{print $1}' $file | $DMENU $COLORS` + goto=$(awk '{print $1}' $file | $DMENU $COLORS) fi #[ -n "$goto" ] && echo "uri $goto" > $4 diff --git a/examples/data/scripts/load_url_from_history.sh b/examples/data/scripts/load_url_from_history.sh index bec6258..5156eee 100755 --- a/examples/data/scripts/load_url_from_history.sh +++ b/examples/data/scripts/load_url_from_history.sh @@ -4,19 +4,19 @@ history_file=${XDG_DATA_HOME:-$HOME/.local/share}/uzbl/history [ -r "$history_file" ] || exit 1 # choose from all entries, sorted and uniqued -# goto=`awk '{print $3}' $history_file | sort -u | dmenu -i` +# 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 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. - goto=`tac $history_file | $DMENU $COLORS | cut -d ' ' -f -3 | awk '{print $NF}'` + goto=$(tac $history_file | $DMENU $COLORS | cut -d ' ' -f -3 | awk '{print $NF}') else DMENU="dmenu -i" # choose from all entries (no date or title), the first one being current url, and after that all others, sorted and uniqued, in ascending order - current=`tail -n 1 $history_file | awk '{print $3}'`; - goto=`(echo $current; awk '{print $3}' $history_file | grep -v "^$current\$" \ - | sort -u) | $DMENU $COLORS` + current=$(tail -n 1 $history_file | awk '{print $3}'); + goto=$((echo $current; awk '{print $3}' $history_file | grep -v "^$current\$" \ + | sort -u) | $DMENU $COLORS) fi [ -n "$goto" ] && echo "uri $goto" > $4 diff --git a/examples/data/scripts/session.sh b/examples/data/scripts/session.sh index 1059b5e..acd6934 100755 --- a/examples/data/scripts/session.sh +++ b/examples/data/scripts/session.sh @@ -26,7 +26,7 @@ fi case $act in "launch" ) - urls=`cat $sessionfile` + urls=$(cat $sessionfile) if [ "$urls." = "." ]; then $UZBL else -- cgit v1.2.3