Link to home
Start Free TrialLog in
Avatar of team2005
team2005

asked on

Script dosent work ?

Hi!

The given source script give me this error message:
Illegal variable name.

What is wrong with this script ?

Please help asap.


if [ $(date +%A) == "Friday" ]; then
        if [ -f backupfile ]; then
            cp backupfile /BACKUPFRIDAY/backupfile-`date +"%Y%m%d"`; 
        else 
            echo "friday backup file missing" | mail yourmail@ddress -s "missing backup" -; 
        fi;
    fi;

Open in new window

Avatar of omarfarid
omarfarid
Flag of United Arab Emirates image

try

if [ $(date +%A) == "Friday" ]; then
        if [ -f backupfile ]; then
            cp backupfile  /BACKUPFRIDAY/backupfile-`date +"%Y%m%d"`
        else
            echo "friday backup file missing" | mail yourmail@ddress -s "missing backup"
        fi;
    fi;

if you still have problem run the script as

sh -x scriptname

and post output
Avatar of team2005
team2005

ASKER

Hi!

Still dosent work, but it give this output:

Line 24 : [Friday==Friday] : command not found

ASKER CERTIFIED SOLUTION
Avatar of omarfarid
omarfarid
Flag of United Arab Emirates image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi"

Still dosent work ?

Tor
Run the script as

sh -x scriptname

and post the output.
Is the script set to use the bash shell?

#!bin/bash
Hi!

Yes, its set to use the bash shell.

Tor
can you post the output of

sh -x scriptname

as requested before?
Hi!

Have give you that aoutput:

Line 24 : [Friday==Friday] : command not found

Tor
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
here it shows that it is space problem. did you try to put space before and after the == and [ ]
Hi!!

Tryed zmo code, and works now :)

Split the points then :)

Thanks for help.