diff options
Diffstat (limited to 'old/lipsumsh')
-rwxr-xr-x | old/lipsumsh | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/old/lipsumsh b/old/lipsumsh new file mode 100755 index 0000000..d229877 --- /dev/null +++ b/old/lipsumsh @@ -0,0 +1,72 @@ +#!/bin/sh + +dictionary=/home/timmy/.local/share/lorem-ipsum-dictionary + +shuf -r -n$1 $dictionary | awk -f- hi hello yolo <<'AWKSCRIPT' +BEGIN { for(i = 1; i < ARGC; i++) print ARGV[i] } +AWKSCRIPT +echo +#shuf -r -n$1 $dictionary | tr '\n' ' ' + + + + + +exit + +#genipsums() { shuf -r -n$1 $dictionary | tr '\n' ' ' | sed 's/.$//'; } +genipsums() { shuf -r -n$1 $dictionary; } +gensentence() { genipsums $1 | sed ':a;N;$!ba; s/\n/ /g; s/.$//; s/\(^\| \)\([a-z]\)/\1\u\2/'; } + +genparagraph() { + sentences=`shuf -n1 -i 4-12` + echo -n '\t' + + for i in `seq $sentences`; do + words=`shuf -n1 -i 1-10` + [ "$loremipsumtext" = '1' ] && echo -n "Lorem ipsum " && genipsums $words && loremipsumtext=0 || gensentence $words + [ "$words" -le 4 ] || [ `shuf -n1 -i 0-2` = 1 ] && echo -n ', ' && genipsums `shuf -n1 -i 3-10` # make more complex + echo -n '. ' + done + echo +} + +loremipsumtext=1 + +genparagraph + + + +#exit +# +#dictionary=/home/timmy/.local/share/lorem-ipsum-dictionary +# +#ipsums=$1 +# +##set -- `tr '\n' ' ' < $dictionary` +#set -- `cat $dictionary` +# +##rand=`od -An -N$ipsums /dev/urandom` +# +#shuf -r -n$ipsums -i 1-$# | while read line; do +# eval echo -n \${$line} +# echo -n ' ' +#done +# +#echo +# +#exit +# +# +# +#words=`wc -w $dictionary | cut -d' ' -f1` +# +#echo -n '\tLorem ipsum ' +# +#shuf -r -n$1 -i 1-$words | while read line; do +# #cut -z -d' ' -f$line $dictionary && echo -n ' ' +# head -n$line $dictionary | tail -n1 | tr -d '\n' +# num=`shuf -n1 -i 1-100` +# ([ "$num" -lt 10 ] && echo -n '. ') || ([ "$num" -gt 90 ] && echo -n ', ') || ([ "$num" = '50' ] && echo -n '.\n\t') || echo -n ' ' +#done +#echo |