I found this shell script which is running well in the shell. But I dont know the working syntax for the Desktop Command Execution Widget. random.sh: Code: #/bin/sh # randomquote - Given a one-line-per-entry datafile, this # script randomly picks one line and displays it. Best used awkscript="randomquote.awk.$$" if [ $# -ne 1 ] ; then echo "Usage: randomquote datafilename" >&2 exit 1 elif [ ! -r "$1" ] ; then echo "Error: quote file $1 is missing or not readable" >&2 exit 1 fi trap "/bin/rm -f $awkscript" 0 cat << "EOF" > $awkscript BEGIN { srand() } { s[NR] = $0 } END { print s[randint(NR)] } function randint(n) { return int (n * rand() ) + 1 } EOF awk -f $awkscript < "$1" exit 0 With "random.sh textfile.txt" it writes one line to the shell. But how can I get this working in Desktop Command Execution Widget ? Thanks
#/bin/sh # randomquote - Given a one-line-per-entry datafile, this # script randomly picks one line and displays it. Best used awkscript="randomquote.awk.$$" if [ $# -ne 1 ] ; then echo "Usage: randomquote datafilename" >&2 exit 1 elif [ ! -r "$1" ] ; then echo "Error: quote file $1 is missing or not readable" >&2 exit 1 fi trap "/bin/rm -f $awkscript" 0 cat << "EOF" > $awkscript BEGIN { srand() } { s[NR] = $0 } END { print s[randint(NR)] } function randint(n) { return int (n * rand() ) + 1 } EOF awk -f $awkscript < "$1" exit 0