Note that there are some explanatory texts on larger screens.

plurals
  1. POBash not sourcing code as expected
    text
    copied!<p>I have these two scripts, <code>configScript.sh</code>and <code>genScript.sh</code>. The first one works just the way I want it to work. It adds the correct values into <code>options.sh</code> and <code>echo</code> the right message. However, I want <code>genScript.sh</code> to accept the current argument in <code>options.sh</code> and output the correct <code>echo</code>. As it is now when I run <code>genScript.sh</code> it returns <code>null</code> and I can't figure out why.</p> <pre><code>#!/bin/bash -x #configScript.sh func() { echo " Choose 1 - Option 1 2 - Option 2 " echo -n " Enter selection: " read select case $select in 1 ) echo " Option 1 chosen" . ./genScript.sh one cat &lt;&lt; EOF &gt;options.sh OPTION=$OPTION EOF ;; 2 ) echo " Option 2 chosen" . ./genScript.sh two cat &lt;&lt; EOF &gt;options.sh OPTION=$OPTION EOF ;; esac } func </code></pre> <hr> <pre><code>#!/bin/bash -x #genScript.sh . options.sh OPTION=$1 func2() { if [ "$OPTION" == one ] ; then echo "Option one" elif [ "$OPTION" == two ] ; then echo "Option two" else echo "null" fi } func2 </code></pre> <p>I managed to get <code>genScript.sh</code> to work the way I want by removing <code>OPTION=$1</code>. When I do that <code>genScript.sh</code> will accept the value inside <code>options.sh</code> and will output the right <code>echo</code> . BUT when I remove <code>OPTION=$1</code> <code>configScript.sh</code> stops working as it should, it doesn't update <code>options.sh</code> with a new value anymore.</p>
 

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