|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hello, In bash/sh environment I use 'set -u' to catch unset variables. I have: envcfg=${EnvRootDir}/instance/env_path.cfg .. ${envcfg} > ${errmsgs} 2>&1 Neither checking the value of $? nor redirecting the output let me catch the 'unbound variable' error produced by sourcing ${envcfg} How do I catch the errors in above scenario? Thanks, Farid |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Wed, 16 May 2007 12:26:49 -0600, Farid Hamjavar
<hamjavar@unm.edu> wrote: > > > > Hello, > > > In bash/sh environment I use 'set -u' to catch > unset variables. > > I have: > > envcfg=${EnvRootDir}/instance/env_path.cfg > . ${envcfg} > ${errmsgs} 2>&1 > > > > Neither checking the value of $? nor redirecting > the output let me catch the 'unbound variable' error > produced by sourcing ${envcfg} > > > How do I catch the errors in above scenario? > [ -f $envcfg ] || { echo "cfg file not found" >&2; exit ; } Where will the error messages go if ${errmsgs} is not valid? Perhaps you should use a default value like ${errmsgs:-$HOME/my_errors} -- A shortcut is the longest distance between two points. |
|
![]() |
| Outils de la discussion | |
|
|