repo.or.cz
/
hband-tools.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
add proper error handling for all final exec calls
[hband-tools.git]
/
user-tools
/
corner_time
blob
c1fc10c532893f3f261ce142afedae8d6acc28d6
1
#!/bin/bash
2
3
true
<<EOF
4
=pod
5
6
=head1 NAME
7
8
corner_time - Place a digital clock in the upper right hand corner of the terminal
9
10
=cut
11
12
EOF
13
14
15
fmt
=
${1:-%H:%M:%S}
16
str
=
$
(
date
+
"
$fmt
"
)
17
18
[
-z
"
$COLUMNS
"
] &&
COLUMNS
=
`tput cols`
19
20
while
[
-w
/
proc
/
$$
/
fd
/
1
];
do
21
echo -ne
"
\033
[s
\033
[1;"
$
((
COLUMNS-
${#str}
+
1
))
"H$(date +"
$fmt
")
\033
[u"
22
sleep
0.25
23
done
24