2022/init-day.sh

24 lines
289 B
Bash
Executable File

#!/bin/sh
BASEDIR=$(dirname "$0")
if [ ! -z "$1" ]
then
DAY=$(printf "%02d" "$1")
else
DAY=$(date +%d)
fi
if [ ! -d $DAY ]
then
mkdir $DAY
fi
if [ ! -f $DAY/script.rb ]
then
sed "s/NB/$DAY/" $BASEDIR/template.rb >$DAY/script.rb
chmod +x $DAY/script.rb
fi
vim $DAY/script.rb