mirror of
https://github.com/natelandau/shell-scripting-templates.git
synced 2025-11-08 13:13:47 -05:00
added timestamps
This commit is contained in:
@@ -18,12 +18,14 @@
|
|||||||
scriptName=`basename $0` #Set Script Name variable
|
scriptName=`basename $0` #Set Script Name variable
|
||||||
scriptBasename="$(basename ${scriptName} .sh)" # Strips '.sh' from scriptName
|
scriptBasename="$(basename ${scriptName} .sh)" # Strips '.sh' from scriptName
|
||||||
|
|
||||||
# NOW
|
# TIMESTAMPS
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
# Will print the current date and time in the format:
|
# Prints the current date and time in a variety of formats:
|
||||||
# 01-02-2015 01:09:54 PM
|
#
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
now=$(date +"%m-%d-%Y %r") #Set Timestamp in variable
|
now=$(date +"%m-%d-%Y %r") # Returns: 06-14-2015 10:34:40 PM
|
||||||
|
datestamp=$(date +%Y-%m-%d) # Returns: 2015-06-14
|
||||||
|
timestamp=$(date +%Y%m%d_%H%M%S) # Returns: 20150614_223440
|
||||||
|
|
||||||
# THISHOST
|
# THISHOST
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user