[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[PATCH] Added a check to see if user is running lh_clean from a sane location (i.e. not config/)



On Mon, Nov 12, 2007 at 09:06:13PM +0000, Kai Hendry wrote:
> ---
>  helpers/lh_clean |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/helpers/lh_clean b/helpers/lh_clean
> index 3fa8fc5..77c1ad9 100755
> --- a/helpers/lh_clean
> +++ b/helpers/lh_clean
> @@ -42,6 +42,13 @@ else
>  	ARGUMENTS="${@}"
>  fi
>  
> +# Avoid cases were users accidentally nuke their config/binary
> +if [ $(basename ${PWD}) == "config" ] || [ ! -d "config" ]
== is a bashism which is for regexes, for posix compatibility use just
[ a = b ]

Also use [ .. ] && [ .. ] instead of [ .. -a .. ] (the latter is an
XSI-ism which AIUI is an extension of posix).

And [ ! .. ] rather than ! [ .. ].

And [ .. ] rather than [[ .. ]].

And don't use "function".

Justin



Reply to: