Formatting the date output in bash is simple:
date + "%Y-%m-%d";
An example of assigning to a variable and using:
now=`date + "%Y-%m-%d"`;
cp /etc/hosts ~/hosts_${now};
For more information, see the manual.
Formatting the date output in bash is simple:
date + "%Y-%m-%d";
An example of assigning to a variable and using:
now=`date + "%Y-%m-%d"`;
cp /etc/hosts ~/hosts_${now};
For more information, see the manual.