arrays - What is causing my custom zsh script terminal command to hang? -
i've created custom zsh script taking notes day , keeping track of time can fill out time sheets easier. works fine of time every , again hangs. logs txt file when hangs doesn't execute "say" command.
i think it's problem how i'm selecting random string don't know enough zsh fix it.
i'm using zsh , in .zshrc file.
createlog() { logfile=$home/google\ drive/autosdls.txt # chmod 755 $logfile lastline="$(tail -1 $logfile)" lasttime="$(grep -oe "[[:digit:]]{10}" <<<"$lastline")" time="$(date +%s)" timespent=$((($time-$lasttime)/60)) echo "$timespent" echo "[ ] $timespent minutes : $1 |$(date +%s)|" >> $logfile 2>&1 # seed random generator random=$$$(date +%s) encouragements=("greatjob!" "thank you." "productivity node assimilated" "well done. ambition matched zeal" "engage" "you're best! around! nothing's gonna ever keep down.") selectedexpression=${encouragements[($random % ${#encouragements[@]})-1]} $selectedexpression # echo $selectedexpression } alias sdlog=createlog
Comments
Post a Comment