PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > comp.unix.shell > Capturing 'unbound variable' error
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.unix.shell Using and programming the Unix shell.

Capturing 'unbound variable' error

Réponse
 
LinkBack Outils de la discussion
Vieux 16/05/2007, 19h26   #1
Farid Hamjavar
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Capturing 'unbound variable' error


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

  Réponse avec citation
Vieux 16/05/2007, 21h19   #2
Bill Marcum
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Capturing 'unbound variable' error

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.
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 02h22.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,08125 seconds with 10 queries