Update vocafortune
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
while [ $# -gt 0 ]; do export "${1#-}"="$2"; shift 2; done # now it can be -l ./vocafortunes like a proper program!!!! # argument handling # i can use this anywhere!!!!!!! save this you!!!!!!
|
while [ $# -gt 0 ]; do export "${1#-}"="$2"; shift 2; done # now it can be -l ./vocafortunes like a proper program!!!! # argument handling # i can use this anywhere!!!!!!! save this you!!!!!!
|
||||||
#fortune script
|
#fortune script
|
||||||
shopt -s globstar
|
shopt -s globstar
|
||||||
if [ -z "$l" ]; then export "DIR"="~/.local/share/tetosong/vocafortunes/**"; else export "DIR"="$l/**"; fi
|
if [ -z "$l" ]; then export "DIR"="$HOME/.local/share/tetosong/vocafortunes/**"; else export "DIR"="$l/**"; fi
|
||||||
for file in $DIR; do if [[ -f "$file" ]]; then readarray -td '`' temp < "$file"; array+=("${temp[@]}"); fi; done
|
for file in $DIR; do if [[ -f "$file" ]]; then readarray -td '`' temp < "$file"; array+=("${temp[@]}"); fi; done
|
||||||
export "ITEMS"="${#array[@]}"
|
export "ITEMS"="${#array[@]}"
|
||||||
export "CHOICE"="$(shuf -i 1-$ITEMS -n 1)"
|
export "CHOICE"="$(shuf -i 1-$ITEMS -n 1)"
|
||||||
|
|||||||
Reference in New Issue
Block a user