Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Quoting almost always fixes this type of problem.</p> <pre><code>exec myBootStrap "$arguments" </code></pre> <p>Demo:</p> <pre><code>$ a='"abc def" ghi' $ echo "$a" "abc def" ghi $ args $a 3 args: &lt;"abc&gt; &lt;def"&gt; &lt;ghi&gt; $ args "$a" 1 args: &lt;"abc def" ghi&gt; $ cat args #! /bin/sh # Greg Wooledge's args script printf "%d args:" $# printf " &lt;%s&gt;" "$@" echo </code></pre> <p><strong>Edit</strong>:</p> <p>OK, I spent some time analyzing what your Bash script is actually doing. It's going through a lot of gyrations to simply try to produce exactly the same arguments it was given and then pass them to the Python script.</p> <p>It could simply be replaced by:</p> <pre><code>exec myBootStrap "$@" </code></pre> <p>However, I presume that you're actually doing some other processing there which we don't see. Based on that, I've modified your script so it can be used as a basis for something like that.</p> <pre><code>#!/bin/bash declare -a argv for ((i = 1; i &lt;= $#; i += 1)) do arg=${@:i:1} if [[ "$arg" == "--preload"* ]]; then marg=${@: ++i:1} preLoadO=$arg preLoadA="${marg}" argv+=("$arg") argv+=("$preLoadA") elif [[ "$arg" == "--postload"* ]]; then marg=${@: ++i:1} postLoadO=$arg postLoadA="${marg}" argv+=("$arg") argv+=("$postLoadA") else argv+=("$arg") fi done exec ./myBootStrap "${argv[@]}" </code></pre> <p>The arguments must be passed as a quoted array. You had already built the array, but then you flattened it with a <code>printf</code>. </p> <p>Note that an array slice is already an arithmetic context so you don't need <code>$(())</code> inside it. I removed the separate <code>i=i+1</code> (which concatenates characters so you get <code>1+1+1+1</code> after a while) and just put a pre-increment inside the array slice. The space before the first plus is required since <code>:+</code> is significant inside an brace expansion. If you want, you can do the increment separately like this: <code>((i++)); marg=${@:i:1}</code> (of course on separate lines if you prefer).</p> <p>I changed your array appends to the much simpler <code>+=</code> form and added quoting to them.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload