Day 139
Bash dtb create.sh script
Updated the script to create a markdown dtb file to the following:
FILE=_posts/$(date +%Y-%m-%d)-day$(date +%j).markdown
DATE=$(date +%Y-%m-%d\ %H:%M:%S\ +0100)
if test -f "$FILE"; then
vim $FILE
exit 1
fi
echo "Creating file $FILE"
touch $FILE
echo "Adding stuff"
/bin/cat <<EOM >> $FILE
---
layout: post
title: "Day $(date +%j)"
date: $DATE
categories: []
---
EOM
vim $FILE
Now it’s closer to create_or_open.sh and doesn’t overwrite anything if run again by error, doesn’t add any unused parts, and opens the file if it exists already.
Bash check if file exists
if test -f "$FILE"; then
vim $FILE
exit 1
fi
Bash exit script
exit 1
or whatever status code.
Bash suppress output of command (bash redirection)
SO:
command > /dev/null 2>&1
redirects both stdout and stderr to /dev/null;
command &> /dev/null &
works for me too, though it may not work in all shells.
command > /dev/null
still shows errors.
Progress notes
Added to anki everything until this page on the pro git ebook
Nel mezzo del deserto posso dire tutto quello che voglio.