| Stephane CHAZELAS 2007-05-18, 1:23 pm |
| 2007-05-16, 15:56(-06), Farid Hamjavar:
[...]
> % ./driver.sh
> ./instance/env_path.cfg: line 58: EnvGGGZIP: unbound variable
>
> ****************************
>
>
> Such 'unbound variable' errors, like the one
> above, viewable ONLY on interactive shell session.
>
>
> I like to detect that inside a script (e.g. driver.sh)
>
>
> Inside driver.sh I have a line:
>
> . env_path.cfg
[...]
There's not much you can do. "." causes the code in the
corresponding shell to be executed by the current shell process.
If there's something that causes an exit there, then that exits
the whole shell.
You could do things like:
if code=$(
. env_path.cfg
set
export
) && eval "$code"; then
echo went fine
else
echo did not go fine
fi
(untested)
--
Stéphane
|