X-Git-Url: https://zdv2.bktei.com/gitweb/BK-2020-03.git/blobdiff_plain/17d7b80328e653a7d65c4aac24c4f8173409c321..0d22dfcdb7eab1975d56ed36967885707470c828:/user/bkrandlujvo diff --git a/user/bkrandlujvo b/user/bkrandlujvo new file mode 100755 index 0000000..35e09e8 --- /dev/null +++ b/user/bkrandlujvo @@ -0,0 +1,59 @@ +#!/bin/bash +# usage: bkrandlujvo + +INPUT_FILE="/home/baltakatei/Sync/kodawkuori-07/2020/reference-PERS/lojban/20190626..gismu_english_order.txt" +if [ ! -f "$INPUT_FILE" ]; then echo "ERROR: gismu list text file not found." 2>&1 ; exit 1; fi + +randGismuDef () { + # usage: randGismuDef [gismu.txt file] + # output: <>,<> + FILE="$1" + randLineNum=$(shuf -n1 -i2-$(cat "$FILE" | wc -l)) # Generate random line number of FILE + # Output random 2nd space-delimted field (gismu) from file + #echo $(cat "$FILE" | cut -d' ' -f2-3 | head -n"$randLineNum" | tail -n1 ) + echo $(cat "$FILE" | awk '{print $1 "," $3}' | head -n"$randLineNum" | tail -n1 ) +} + +randGismu () { + # usage: randGismu [gismu.txt file] + # output: <> + FILE="$1" + randLineNum=$(shuf -n1 -i2-$(cat "$FILE" | wc -l)) # Generate random line number of FILE + # Output random 2nd space-delimted field (gismu) from file + echo $(cat "$FILE" | awk '{print $1}' | head -n"$randLineNum" | tail -n1 ) +} + +GISMU1=$(randGismu "$INPUT_FILE") +GISMU2=$(randGismu "$INPUT_FILE") +GISMU3=$(randGismu "$INPUT_FILE") + +#RAW1=$(randGismuDef "$INPUT_FILE") +#RAW2=$(randGismuDef "$INPUT_FILE") +#RAW3=$(randGismuDef "$INPUT_FILE") + +#GISMU1=$(echo "$RAW1" | cut -d',' -f1) +#GISMU2=$(echo "$RAW2" | cut -d',' -f1) +#GISMU3=$(echo "$RAW3" | cut -d',' -f1) + +#DEF1=$(echo "$RAW1" | cut -d',' -f2) +#DEF2=$(echo "$RAW2" | cut -d',' -f2) +#DEF3=$(echo "$RAW3" | cut -d',' -f2) + +echo "$GISMU1 $GISMU2 $GISMU3" +#echo "$DEF1 $DEF2 $DEF3" + +if command -v jbofihe 1>/dev/null 2>&1; then + echo "$GISMU1" | jbofihe -x + echo "$GISMU2" | jbofihe -x + echo "$GISMU3" | jbofihe -x +else + echo "ERROR: jbofihe command not available." 2>&1; +fi + +if command -v jvocuhadju 1>/dev/null 2>&1; then + jvocuhadju "$GISMU1" "$GISMU2" "$GISMU3"; +else + echo "ERROR: jvocuhadju command not available." 2>&1; +fi + +exit 0