Problem with the date help

Hi everybody

I have a problem with a shell. It runs every night just once a night on my sun system.

#!/bin/ksh
export pfad_work=/usr/users/ftp/testdaten
export pfad_daten=/u01/projects/iris_unix/inp_test_daten/data
export pfad_term=/u01/projects/iris_unix/inp_test_term/data

cd $pfad_work
chmod 777 /usr/users/ftp/testdaten/*

chown oracle:dba /usr/users/ftp/testdaten/*.VAR

cp -p $pfad_work/GA`date +%d%m`.VAR $pfad_daten/GA`date +%d%m`.46.vf1
cp -p $pfad_work/GA`date +%d%m`.VAR $pfad_term/GA`date +%d%m`.46.vf1

mv $pfad_work/GA`date +%d%m`.VAR $pfad_work/processed

For example yesterday i had a data called "GA0307.VAR" the shell can not access it because it is looking for "GA307.VAR" This "0" it can not read. Does any one have a idea how i can make this read a double digite number in the date?? This does work when the date is double.

Thanks in advance

Peterh

I'm not sure why you are getting a differrence.

If you have a file called "GA0307.VAR" ...... then you want the date expression to be equal to 0307 - rather than 307.

That is using %d....which is what you are using. Why do you think that your script is returning 307.

insert this line in your script just after the variable exporting.

echo "$pfad_work/GA`date +%d%m`.VAR"

This will echo the GA0307 that you are looking for. Please try this to let me know what returns after this echo - and if you still think it is looking for GA307.

You'd have to use %e to get 307...and then it would be preceeded with a space...which is not great for filenames.
%d =day of month [1,31]; single digits are preceded by 0
%e =day of month [1,31]; single digits are preceded by a space

Good morning, Peter

Well I found out that the script was working. The job that processed the data was the problem why I didn't get "0" in my date.

Thanks about the tip with %e. Again thanks for the help.

Peterh

:slight_smile: