1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
#!/bin/bash day=day$(date +%d) if [ "x$1" != "x" ] ; then day=$(printf "day%02d" $1) fi if [ -d $day ] ; then echo "Directory exists" exit 1 fi echo "Creating $day..." mkdir $day cat > $day/part1 <<EOT #!/usr/bin/env ruby input = gets.chomp input = \$stdin.readlines.map(&:chomp) EOT chmod +x $day/part1 touch $day/input