filenames - Bash: how to name a file after numeric id of previous file in same folder? -


i trying create simple script taking notes command line. file names should contain each note's number , creation date. so:

01_20130711.txt 02_20130722.txt 03_20130731.txt ... 

thus, note numbers should count upwards last note entered. also, when notes folder empty, first file created there should 01 number.

how can accomplish automatic numeration of kind?

set *.txt [[ ${*: -1} =~ [0-9]+ ]] printf -v next '%02d_%d.txt' $(( bash_rematch + 1 )) $(date +%y%m%d) touch $next 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -