On Jan 29, 2008 11:42 AM, Hamish <[EMAIL PROTECTED]> wrote:
> Martin Wegmann wrote:
> > unfortunately I added 'rm .* ' instead of a 'rm $variable.*' in a
> > GRASS script, hence I had to setup a new user account
>
> just to highlight the trap, as I've fallen into it too:
>
> if $variable is unset for some reason, 'rm "$variable".*' becomes
> 'rm "".*' which is processed by the shell as 'rm .*'
>
> lesson: be very careful with rm, try to anticiapte failure modes, and
> set up that rsync cron job to backup your home directory.

... and maybe do $variable testing in the script, e.g.

if  [ -z "$variable" ] ; then
    echo "variable not set"
else
    rm -f "$variable".*
fi

Markus
_______________________________________________
grass-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to