I need a script that will create a file with the next file in a sequence. Each execution of the script should only create one file and the script could be run zero or more times on any given day. The files should be named after the current date in format %y%m%d
with the second file having -01
appended, the third file to be created on a given date would have -02
etc. For example:
20170125.txt // first file create on the day.
20170125-01.txt // 2nd file
20170125-02.txt // 3rd file
So far I've got this super basic script that creates my first daily file but I'm stumped as to how to do the incremental numbering after that.
#! /bin/bash
DATE=`date +%Y%m%d`
touch "$DATE.txt"
./newsketch.sh
and have all the boilerplate ready to go. – Greg B Jan 25 '17 at 11:05