Re: A bug when using bash shell variable

2022-01-13 Thread ju nan
22 7:04:16 PM To: ju nan ; bug-bash@gnu.org Subject: Re: A bug when using bash shell variable On Thu, Jan 13, 2022 at 11:55:45AM +0100, Kusalananda Kähäri wrote: > > When you want to store several separate arguments, do not combine them > into a single string. > > Compare this >

Re: A bug when using bash shell variable

2022-01-13 Thread Andreas Kusalananda Kähäri
On Thu, Jan 13, 2022 at 11:55:45AM +0100, Kusalananda Kähäri wrote: > > When you want to store several separate arguments, do not combine them > into a single string. > > Compare this > > args="-a 'hello world' -b '1 * 3'" > printf '"%s"\n' $args > > and > > args=( -a 'hello

Re: A bug when using bash shell variable

2022-01-13 Thread Andreas Kusalananda Kähäri
When you want to store several separate arguments, do not combine them into a single string. Compare this args="-a 'hello world' -b '1 * 3'" printf '"%s"\n' $args and args=( -a 'hello world' -b '1 * 3' ) printf '"%s"\n' "${args[@]}" Using an unquoted variable

Re: A bug when using bash shell variable

2022-01-13 Thread ju nan
Ok, thank you so much for this solution😇 Get Outlook for Android<https://aka.ms/AAb9ysg> From: Alex fxmbsw7 Ratchev Sent: Thursday, January 13, 2022 6:45:03 PM To: ju nan Cc: yesxorno via Bug reports for the GNU Bourne Again SHell Subject: Re: A bug when

Re: A bug when using bash shell variable

2022-01-13 Thread Alex fxmbsw7 Ratchev
in other words shell separates between spaces and quotes u need quoting right, otherwise its flat args or one arg if quoted not right arr=( -arg{1,2,3} ) cmd "${arr[@]}" tells to pass every arr member with quotes On Thu, Jan 13, 2022, 11:42 Alex fxmbsw7 Ratchev wrote: > args=( -append "opt wit

Re: A bug when using bash shell variable

2022-01-13 Thread Alex fxmbsw7 Ratchev
args=( -append "opt with spaces" ) cmd "${args[@]}" other_arg On Thu, Jan 13, 2022, 11:33 ju nan wrote: > I hava run into some troubles when I use bash shell to execute qemu, here > is the log. > > > > 1. Run qemu with arguments directly in bash shell, I use strace to > track execve syscall,

A bug when using bash shell variable

2022-01-13 Thread ju nan
I hava run into some troubles when I use bash shell to execute qemu, here is the log. 1. Run qemu with arguments directly in bash shell, I use strace to track execve syscall, everything goes well junan@u0:~/Documents/coding/run-riscv-qemu-linux$ strace qemu-system-riscv64 -nographic -mach