> You can also do something like
>
> while [ $# -ne 0 ]
> do
>       arg=$1
>       case $1 in
>       [^-]*)
>               break
>               ;;
>
>       --clean|--purge|--stage|--source|...)
>               f=${arg#--}
>               $f
>               ;;
>
>       --otheroption)
>               shift
>               something=$1
>
>       *)
>               exec >&2
>               echo "Unknown option: $1"
>               echo "Run $0 --help for help."
>               exit 1
>               ;;
>       esac
>
>       shift || { echo "Option requires an argument: $arg"; exit 2; } >&2
> done

yeah :)

shorter but more readable:
for ARGUMENT in "${ARGUMENTS}"; do
        case "${ARGUMENT}" in
                --all) Clean_all ;;
                --cache) Clean_cache ;;
                --chroot) Clean_chroot ;;
                --binary) Clean_binary ;;
                --remove) Clean_remove ;;
                --purge) Clean_purge ;;
                --stage) Clean_stage ;;
                --source) Clean_source ;;
                *) "${0}" --usage ;;
        esac
done

btw, it doesn't resolve the issue ;)

i mean the bug still exist:
sudo lh_clean --purge
lh_clean: unrecognized option `--purge'

it seems related to Arguments function handling ...

cheers,

Fathi

_______________________________________________
debian-live-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/debian-live-devel

Reply via email to