Debian Codegraph @

ex51.sh

raw symbols SCIP
1 #!/bin/bash
2 # Exercising the 'date' command
3
4 echo "The number of days since the year's beginning is `date +%j`."
5 # Needs a leading '+' to invoke formatting.
6 # %j gives day of year.
7
8 echo "The number of seconds elapsed since 01/01/1970 is `date +%s`."
9 # %s yields number of seconds since "UNIX epoch" began,
10 #+ but how is this useful?
11
12 prefix=temp
13 suffix=$(date +%s) # The "+%s" option to 'date' is GNU-specific.
14 filename=$prefix.$suffix
15 echo "Temporary filename = $filename"
16 # It's great for creating "unique and random" temp filenames,
17 #+ even better than using $$.
18
19 # Read the 'date' man page for more formatting options.
20
21 exit 0