Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

jim date: illegal option -- I

on macos



It seems Bash on Mac doesn't work quite the same as Linux.

Try this instead. It works for me. Let me know.

Copy it to your ~/.bash_aliases. And source it.

  alias jim='
    function _jim() {
        journaldir="$HOME/journal"
        year=`date "+%Y"`
        today=`date "+%Y-%m-%d"`
        yearpath="$journaldir/$year"
        [[ -d "$yearpath" ]] || mkdir -p $yearpath         
        jfile="log_$today.md"
        jfilepath="$journaldir/$year/$jfile"
        header="# Log: $today\n\n# Highlights:\n\n" 
        [[ -f "$jfilepath" ]] && echo "Opening log: $jfilepath" || { echo "Creating new log: $jfilepath" ; echo -e "$header" >  $jfilepath ; } 
        vi "$jfilepath"
    }; _jim'




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: