[prev in list] [next in list] [prev in thread] [next in thread] 

List:       libguestfs
Subject:    Re: [Libguestfs] [PATCH] virt-copy, virt-tar: show help for -h
From:       Maros Zatko <mzatko () redhat ! com>
Date:       2015-01-23 14:54:23
Message-ID: 54C2609F.1030105 () redhat ! com
[Download RAW message or body]

On 01/23/2015 03:21 PM, Richard W.M. Jones wrote:
> On Fri, Jan 23, 2015 at 02:59:47PM +0100, Maros Zatko wrote:
>> -exec guestfish --rw -i copy-in "$@"
>> +args=$@
>> +while [ ""x != "$1"x ] ; do
>> +  case $(echo $@ | awk '{print $1}') in
>> +    "-h")
>> +      man $(basename $0)
>> +      exit
>> +      ;;
>> +  esac
>> +  shift 1
>> +done
> Bit confused about what this shell fragment does.  It doesn't look as
> if it would be safe given command line arguments containing spaces
> either.
>
> How about using getopt?
I did it with getopt first, it did not take -h into account unless it was
the first argument and giving confusing answer.
Offending string could be "this is -h the one". Is it (preferably 
easily) solvable?

- maros
>
> Rich.
>

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic