From 4aa1f1c37980dbdc1fdb2fa9e744788daac4d645 Mon Sep 17 00:00:00 2001 From: preston Date: Wed, 8 Mar 2023 15:11:40 -0800 Subject: posix compliant --- sh/getlogs | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'sh/getlogs') diff --git a/sh/getlogs b/sh/getlogs index 349c5ac..d651fe5 100755 --- a/sh/getlogs +++ b/sh/getlogs @@ -1,25 +1,29 @@ -USER=AberrantFlux -REMOTELOGDIR=zncu@aberrantflux.xyz:/home/zncu/.znc/moddata/log/$USER/ -LOGDIR=~/log/irc +#!/bin/sh +USER=LiCoO2 +REMOTELOGDIR="root@prestonpan.tech:/home/preston/.znc/users/$USER/networks/AndreiNet/moddata/log" +LOGDIR=~/.local/share/log/irc NETWORK=AndreiNet -rsync -avzP --rsh=ssh $REMOTELOGDIR $LOGDIR/$USER +rsync -avzP "$REMOTELOGDIR" "$LOGDIR/$USER" echo "Logs available for:" -echo -for CHANNEL in $LOGDIR/$USER/$NETWORK/* +echo "" + +for CHANNEL in $LOGDIR/$USER/log/* do - DATE=$(date -r $CHANNEL +"%Y-%m-%d %H:%M") - NAME="$(basename $CHANNEL)" - echo "$NAME - last edited $DATE" + NAME="$(basename "$CHANNEL")" + # DATE=$(date -r $CHANNEL +"%Y-%m-%d %H:%M") + echo "$NAME" done + while : do CHANNELSELECTION=exit - read -p "Enter the name of a channel to read the most recent log: [exit] " CHANNELSELECTION + printf "Enter the name of a channel to read the most recent log: [exit] " + read CHANNELSELECTION CHANNELSELCTION="${CHANNELSELECTION:=exit}" - if [ $CHANNELSELCTION = exit ]; + if [ "$CHANNELSELCTION" = exit ]; then break fi - LASTLOG="$(ls -t $LOGDIR/$USER/$NETWORK/$CHANNELSELECTION | head -n1)" - less $LOGDIR/$USER/$NETWORK/$CHANNELSELECTION/$LASTLOG + LASTLOG="$(ls -t "$LOGDIR/$USER/log/$CHANNELSELECTION" | head -n1)" + less "$LOGDIR/$USER/log/$CHANNELSELECTION/$LASTLOG" done -- cgit v1.3.1