summaryrefslogtreecommitdiff
path: root/super.sh
blob: 325f86d475ae06b644fb6fc4b8da7accadb96e22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/bash
# SJP 9 Nov 2021
#
# Append the argument to a file, with datestamp

theDate=$(\date -I)     # ISO 8601, natch

# Where to store the log file
logFile=~/box/leger/etc/superLog.txt

# to log a value, the user must include it as an argument
if [ -z $1 ]
    then 
        echo "Usage: provide an argument for super.sh to append to the log"
        exit 1
fi

echo $theDate,$1 >> $logFile
#printf '%s,%s\n' $theDate ,$1   >> $logFile

# Note: double quote expression to preserve carriage returns (thanks, stackoverflow)
echo "$(tail ${logFile})"