P
P
programmer00112019-07-11 23:04:58
linux
programmer0011, 2019-07-11 23:04:58

How to separate arguments in a line in bash for a strace program?

Example
exePath="path_to_program";
exeArgs="--param1=sdfsdf --param2=sdfdf"
strace -xf -o 'path' "$exePath" "$exeArgs"
The program launched in strace takes only one param1 parameter, with a string value with all parameters.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Saboteur, 2019-07-12
@saboteur_kiev

You have too many quotes

exePath="path_to_program";
exeArgs="--param1=sdfsdf --param2=sdfdf"
strace -xf -o path $exePath $exeArgs

J
jcmvbkbc, 2019-07-12
@jcmvbkbc

The best solution I know is with an array:

args=("--param1=value1" "--param2=value with spaces")
"$cmd" "${args[@]}"

Each element of the array will be passed as one parameter.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question