qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC PATCH] vl.c: add -semihosting-config "arg" sub-arg


From: Peter Maydell
Subject: Re: [Qemu-devel] [RFC PATCH] vl.c: add -semihosting-config "arg" sub-argument
Date: Tue, 21 Apr 2015 16:55:12 +0100

On 21 April 2015 at 16:14, Liviu Ionescu <address@hidden> wrote:
> if you insist on the arg= solution, could you be so kind and
> provide a bash script wrapper that passes all arguments ($@)
> using your syntax?


If you're willing to accept bashisms, then:

argstr=""
for arg in "$@"; do
    argstr=${argstr:+$argstr,}arg=${arg//,/,,}
done

qemu-system-arm --semihosting-options "$argstr"


If you want pure POSIX shell then it is slightly
uglier as we have to invoke sed:

argstr=""
for arg in "$@"; do
     o=$(printf '%s.\n' "$arg" | sed s/,/,,/g)
     argstr=${argstr:+$argstr,}arg=${o%.}
done

qemu-system-arm --semihosting-options "$argstr"

(Note the trick with the '.' to ensure correct handling
of trailing newlines in arguments; credit to mdw for
that one.)

-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]