Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is the date command in linux stable? 2

Status
Not open for further replies.

prosper

Programmer
Sep 4, 2001
631
HK
Code:
mytime=$(date +%Y%m%d_%k%M%S)
dname="suse"
networkDir="network"
outputname=$mytime"_"$dname"_"$networkDir.tar.gz
I sometimes got network.tar.gz from outputname.
Does my script have any problem?
Thanks for any help
 
I think you want %H instead of %k. %k can have a space in it before midday.

Also I would recommend this syntax:

Code:
outputname="${mytime}_${dname}_${networkDir}.tar.gz"

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top