[ / / / / / / / / / / / / / ] [ dir / random / 93 / biohzrd / hkacade / hkpnd / tct / utd / uy / yebalnia ][Options][ watchlist ]

/slackware/ - Slackware Linux

#slackware@irc.rizon.net
You can now write text to your AI-generated image at https://aiproto.com It is currently free to use for Proto members.

Name
Email
Subject
REC

0:00

Comment *
File
Select/drop/paste files here
Password (Randomized for file and post deletion; you may also set your own.)
Archive
* = required field[▶Show post options & limits]
Confused? See the FAQ.
Expand all images

File (hide): 138e36187573a13⋯.png (25.53 KB,356x200,89:50,f66e7d73.png) (h) (u)

[–]

 No.31 [Watch Thread][Show All Posts]

Below is the bash script for the terminal clock that I use. To quit the clock, use Ctrl + c.

#!/bin/bash
# clock.sh

# the script is executed inside a while without conditions
while :
do
# time and date are formatted to show HH:MM:SS YYYY-MM-DD
cmd=`date +"%c"`

# cursor's current position is saved through an escape sequence
echo -n -e "\033[s"

# Uncomment the next two lines to clean up the whole first line, although it causes a lot of blinking
#tput cup 0 0 # positions on row 0 col 0 (left top corner)
#tput el # cleans from position to end of line

# to place the clock on the appropriate column, subtract the length of 'HH:MM:SS YYYY-MM-DD', which is 19,
# from the total number of columns
C=$((`tput cols` - 32))
tput cup 0 $C # positions cursor at row 0 col $C

# clock will be shown green inverted
# setaf 2 = green, smso = inverted
COLOR=`tput setaf 7; tput smso`

# back to normal screen colors
NORMAL=`tput sgr0`

# print the time-date output on the above position
echo -n $COLOR$cmd$NORMAL

# restore the cursor to whatever was its previous position
echo -n -e "\033[u"

# script is executed every second
sleep 1
done

____________________________
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
Post last edited at


[Return][Go to top][Catalog][Screencap][Nerve Center][Random][Update] ( Scroll to new posts) ( Auto) 5
0 replies | 0 images | Page ?
[Post a Reply]
[ / / / / / / / / / / / / / ] [ dir / random / 93 / biohzrd / hkacade / hkpnd / tct / utd / uy / yebalnia ][ watchlist ]