2022/init-day.sh

24 lines
289 B
Bash
Raw Normal View History

2022-12-01 11:53:19 +01:00
#!/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