Friday, 2 December 2016

Shell Script Basics 2

jtony@genoa:~/bin$ cat hello.sh
#!/bin/bash

# This is copy a file and appending the date and  time to the end of the file.
# Not the following format is wrong, because you can't add the space between the
# varible name and = symbol.
#date_formatted =$(date +%m_%d_%y-%H.%M.%S)
date_formatted=$(date +%m_%d_%y-%H.%M.%S)
echo "This is the date and Time: " $date_formatted

No comments:

Post a Comment