aboutsummaryrefslogblamecommitdiff
path: root/bin/clog.sh
blob: b62d4f94a4f43104d4fed137ca0a59494ce51469 (plain) (tree)
1
2
3
4
5
6
7
8
9
         
                                                                  
         




                                   
                                    
                                                              


                                                                              

        
              

                            
#!/bin/sh
# Record a timestamped message to a logfile, defaulting to ~/.clog
self=clog

# Ignore arguments
set --

# If we have rlwrap, quietly use it
command -v rlwrap >/dev/null 2>&1 &&
    set -- rlwrap --history-filename=/dev/null -C "$self" "$@"

# Write the date, the standard input (rlwrapped if applicable), and two dashes
# to $CLOG, defaulting to ~/.clog.
{
    date
    "$@" cat -
    printf '%s\n' --
} >>"${CLOG:-"$HOME"/.clog}"