[Libguestfs] [PATCH] virt-copy, virt-tar: show help for -h

Richard W.M. Jones rjones at redhat.com
Fri Jan 23 14:21:42 UTC 2015


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?

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html




More information about the Libguestfs mailing list