capint
10/24/2015 - 3:57 PM

Bash >> Copy

Bash >> Copy

########### Using variable ###########
# The proper syntax for declaring a variable is: variable=$(command –options arguments)
date_formatted=$(date +%m_%d_%y-%H.%M.%S)
# echo "This is the Date and Time: " $date_formatted
######################################################

########### Copy a file and add date time to it ###########
# -i: interactive
# -v: verbose
cp -iv $1 $2.$date_formatted