summaryrefslogtreecommitdiff
path: root/old/lipsumsh
blob: d229877863c7f3300c2341aad570608f6da878d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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