10 February 2013

Format Date and Time in Shell Script

Sometimes on a system we need to create a log / history for the purpose of fault detection or the history of the system.

Nahhh, if you want to create a log using a shell script and want to mark the log file based on time, just use the date function in shell script. For example:
Log.sistem.online-echo $ - $ (date +% d-% m-% Y ---% T). Txt

will output:
log.sistem.online-- 26-06-2010 --- 19:11:23. txt

So, Good Work;-)

No comments:

Post a Comment