aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorColin Okay <colin@cicadas.surf>2022-08-16 11:33:13 -0500
committerColin Okay <colin@cicadas.surf>2022-08-16 11:33:13 -0500
commit7ac3af0281f4177ced334a1457b0ec38579c1969 (patch)
tree689f0dac6aba2ad8608aea8a0f791fa7216f33b2
parent24ad5f47f7db12a4e3af45259364c451c6f655e3 (diff)
[modify] list command to show how long ago last update
-rwxr-xr-xthreadcat-list.sh12
1 files changed, 10 insertions, 2 deletions
diff --git a/threadcat-list.sh b/threadcat-list.sh
index bed799e..6db8ae6 100755
--- a/threadcat-list.sh
+++ b/threadcat-list.sh
@@ -5,6 +5,8 @@ BOARD=$1
LISTING_HEADING="~~~~~~~~~~~~~~~~~~~"
+export CURTIME=`ssh $THREADCAT_USER date +%s`
+
if [ -z "${BOARD}" ]; then
echo "BOARDS"
echo $LISTING_HEADING
@@ -12,9 +14,15 @@ if [ -z "${BOARD}" ]; then
echo ""
echo "TOP LEVEL THREADS"
echo $LISTING_HEADING
- ssh $THREADCAT_USER "ls -lt /opt/threadcat | grep -v ^d" | awk '{print ($6 " " $7 " " $8 " -- " $9);}' | grep -v '^[ \-]*$'
+ ssh $THREADCAT_USER "ls -lt --time-style=+%s /opt/threadcat" | \
+ grep -v ^d | egrep -v '^total [0-9]+$' | \
+ awk '{ mins = (ENVIRON["CURTIME"] - $6) / (60*60); printf "%.0f hrs ago -- %s\n", mins, $7;}'
else
echo "BOARD: $BOARD"
echo $LISTING_HEADING
- ssh $THREADCAT_USER "ls -lt /opt/threadcat/$BOARD | grep -v ^d" | awk '{print ($6 " " $7 " " $8 " -- " $9);}' | grep -v '^[ \-]*$'
+ ssh $THREADCAT_USER "ls -lt --time-style=+%s /opt/threadcat/$BOARD" | \
+ grep -v ^d | egrep -v '^total [0-9]+$' | \
+ awk '{ mins = (ENVIRON["CURTIME"] - $6) / (60*60); printf "%.0f hrs ago -- %s\n", mins, $7;}'
fi
+
+