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.