Unable to print Timestamp
Hi,
I am just trying to print the timestamp. which is not working. #!/bin/bash TSTAMP= date '+%d.%m.%y-%H:%M:%S' echo "${TSTAMP}" It is not displaying anything. Can some body pls tell me what is wrong with the above commands. |
Hi
use that character before and after command : ` and also no whitespace character after = character the command should be : #!/bin/bash TSTAMP=`date '+%d.%m.%y-%H:%M:%S'` echo ${TSTAMP} |
Problem in displaying timestamp
Quote:
If i give ` character before and after the command it is giving an error date '+%d.%m.%y-%H:%M:%S : not found date '+%d.%m.%y-%H:%M:%S command is working in the terminal.. why is it not working in the shell script. |
Did you add the trailing ' ?
Also, since your post explicitly states the shell is bash, you can use: Code:
#!/bin/bash |
All times are GMT -5. The time now is 04:27 PM. |