[gnu.bash.bug] :${abc?abc} exits

ramsdell@LINUS.MITRE.ORG (01/06/90)

bash$ :${abc?abc}
abc: bad substitution
bash$ :${abc?abc}
abc

Process shell exited abnormally with code 1
#### Here is what sh does:
bash$ sh
$ :${abc?abc}
abc: abc
$ 
------------------------
John

bfox@sbphy.ai.mit.edu (Brian Fox) (01/06/90)

   Posted-Date: Fri, 05 Jan 90 12:40:29 EST
   From: ramsdell@linus.mitre.org
   Date: Fri, 05 Jan 90 12:40:29 EST

   bash$ :${abc?abc}
   abc: bad substitution
   bash$ :${abc?abc}
   abc

   Process shell exited abnormally with code 1
   #### Here is what sh does:
   bash$ sh
   $ :${abc?abc}
   abc: abc
   $ 
   ------------------------
   John

Uh, I guess this is fixed, since my shell doesn't exit.  However, I
changed the output to include the variable name from the left.

Why did you type the ":" in front of everything?  Maybe you meant

	${abc:?abc}

???
Brian

ramsdell@LINUS.MITRE.ORG (01/06/90)

Opps! I forgot to say that I am using bash 1.04 with modifications so
that it runs on a NeXT computer.  By the way, I like the idea of
having an interactive shell that is programmed as one programs the
shell invoked by the library routine named system.

>> Why did you type the ":" in front of everything?  Maybe you meant

The ":" command evaluates its arguments and then ignores the results.
You can use it to make sure that a variable is defined as in:

:${DISPLAY?}	# Exit with error when DISPLAY is not defined.

Cryptic, eh?
John

jacob@gore.com (Jacob Gore) (01/06/90)

/ gnu.bash.bug / ramsdell@LINUS.MITRE.ORG / Jan  5, 1990 /
> [...] I am using bash 1.04 with modifications so
> that it runs on a NeXT computer

The mods from the ftp archives?

I get different results:

	jacob@blackbox> echo $BASH_VERSION
	1.04.3
	jacob@blackbox> echo $SHLVL
	2
	jacob@blackbox> bash
	jacob@blackbox> echo $SHLVL
	3
	jacob@blackbox> :${abc?abc}
	abc
	jacob@blackbox> echo $SHLVL
	2
	jacob@blackbox> 

So it prints "abc" and then exits.

Jacob
--
Jacob Gore		Jacob@Gore.Com			boulder!gore!jacob