[ale] How to pass vars to lots of shell scripts?

Adrya Stembridge adrya.stembridge at gmail.com
Fri Oct 18 14:35:58 EDT 2013


Another option is to use an include file to define variables for multiple
scripts.

include.sh

#!/bin/bash
X=xray
Y=yellow
Z=zulu


foobar.sh

#!/bin/bash
source include.sh
echo "$X, $Y, $Z"





On Fri, Oct 18, 2013 at 2:23 PM, Scott Plante <splante at insightsys.com>wrote:

> If I understand what you're asking, this is what the export keyword is for.
>
> ----------x.sh-------------
> X=test
> y.sh
> export X
> y.sh
> -----------y.sh----------
> echo X=$X
> ------------------------
> $ ./x.sh
> X=
> X=test
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ale.org/pipermail/ale/attachments/20131018/2347e97f/attachment.html>


More information about the Ale mailing list