in reply to Re: Re: Aging Script
in thread Aging Script

the 1st if statement here says if the user uses -h appended to the end of the script file, die an tell them how to run the command properly.

the second part says: if it is not a number, die, otherwise set $agedays to $opt_d (the value of -d).

Normally, I would run -d90

By switching the two, you have made the d option the help option, and made the -h option the number of days. By not specifying -d, $agedays is then set to 60 by default, giving you no problems.

By taking things out, and changing the code, it's hard to know what happened. Does you have problems if you run the original code with no mods? Can you post your new code?

if ($opt_h){ die "\ -d[days to age]\n"; } if ($opt_d){ if ($opt_d gt 9){ #tests for strings die "Error: days option must be a number. Use -d[da +ys to age]\n"; }else{ $agedays=$opt_d; } }