| Forum Home | ||||
| Press F1 | ||||
| Thread ID: 81458 | 2007-07-28 07:00:00 | linux: create a file with the date as the name? | wawape**s (11201) | Press F1 |
| Post ID | Timestamp | Content | User | ||
| 573463 | 2007-07-28 07:00:00 | In linux bash shell, i want to create a directory with the date as the name, thanks | wawape**s (11201) | ||
| 573464 | 2007-07-28 07:44:00 | what format do you want the date to be in? you want to run mkdir `date [format options]` run man date to get the format options. |
Dannz (1668) | ||
| 573465 | 2007-07-29 02:04:00 | As a simple first step you could try set DATESTR=`date` . The "`" is the "back quote" on the "~" key. That executes the command enclosed, and returns its output to standard input. I've put it into an environment variable, but you could do it in the command which creates the file. You might be able to use that as the filename as it stands ("$DATESTR"), or you could give the date command a formatting option. e.g. "date +%Y%m%d" would give a year month day sequence which is neater for sorting files. man date (or these days, "date --help | less" ) will give all the options. |
Graham L (2) | ||
| 1 | |||||