[CLUE-Tech] bash question

Sean Reifschneider jafo at tummy.com
Sat Jun 15 16:22:23 MDT 2002


On Fri, Jun 14, 2002 at 10:57:24AM -0700, Keith Hellman wrote:
>Does anyone know how to determine if bash environmental variable exists?

You probably want to read the "Parameter Expansion" section of the bash man
page.  For example:

   guin:jafo$ echo ${unsetvarname:-Hey, this variable is unset}
   Hey, this variable is unset
   guin:jafo$ ${unsetvarname:?Unset variable}
   bash: unsetvarname: Unset variable
   guin:jafo$ echo $?
   1

Sean
-- 
 UNIX was not designed to stop you from doing stupid things, because that
 would also stop you from doing clever things.  -- Doug Gwyn
Sean Reifschneider, Inimitably Superfluous <jafo at tummy.com>
tummy.com - Linux Consulting since 1995. Qmail, KRUD, Firewalls, Python



More information about the clue-tech mailing list