string manipulation in a shell script

Kathy Quinlan kat-free at kaqelectronics.dyndns.org
Sat Jul 17 01:33:31 PDT 2004


Hi guys and Gals,

I have a simple script:

#!/bin/sh

a=ia$(date +%d%m%Y)

tar -cf "$a.zip" "/usr/home/projects/lunaria/items all"
mv $a.zip /usr/home/itemsall/

this nearly does what I want, I would like to put the time in the file 
name aswell. If I put the %T in the date variable, the resultant value 
for $a has : seperating the hours, minutes and seconds.

Try as I might, I can not find away to remove the : and tar spits the 
dummy at them and it causes an IO device error.

I looked through sed and awk, and spent an hour playing, but all to no 
avail.

Anyhelp apreciated,

Regards,

Kat.


More information about the freebsd-questions mailing list