Last active
April 28, 2024 11:53
-
-
Save Misko-2083/46108de792972a5d451f to your computer and use it in GitHub Desktop.
A simple YAD (Yet another Dialog) Time and Date bash script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Pipe | |
while true | |
do | |
echo "1:#$(date '+%T')" | |
echo "1:$(date '+%1S')" | |
echo "2:#$(date '+%D %a')" | |
echo "2:$((60-$(date '+%1S')))" | |
sleep 1 | |
done | yad --progress --title="Time" --bar="Time":NORM --bar="Date":NORM | |
#------------------------------- | |
# Coprocess | |
coproc yad --progress --title="Time" --bar="Time":NORM --bar="Date":NORM | |
exec >&${COPROC[1]} | |
i=1 | |
while ((i<=11)) | |
do | |
seconds=$(date '+%1S') | |
echo "1:#$(date '+%T')" | |
echo "1:${seconds}" | |
echo "2:#$(date '+%D %a')" | |
echo "2:$((60-$seconds))" | |
sleep 1 | |
((i=i+1)) | |
done | |
kill $COPROC_PID | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment