Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!usenet.ins.cwru.edu!cwns1!chet From: chet@cwns1.CWRU.EDU (Chet Ramey) Newsgroups: gnu.bash.bug Subject: Re: More :${abc?abc} exits Message-ID: <1990Jan8.221741.3193@usenet.ins.cwru.edu> Date: 8 Jan 90 22:17:41 GMT References: <9001052019.AA01516@dash.mitre.org> Reply-To: chet@po.CWRU.Edu Distribution: gnu Organization: Case Western Reserve Univ. Cleveland, Ohio, (USA) Lines: 31 In article <9001052019.AA01516@dash.mitre.org> barratt@dash.mitre.org writes: >Brian, > With regard to John Ramsdell's question about parameter >expansion: The syntax > ${param:?[value]} >is supposed to substitute "param" if it is not null, otherwise it >should write "value" to stderr. If value is omitted, then sh writes > param: parameter null or not set It does this when the shell is interactive. When the shell is not interactive, it exits. The POSIX spec said nothing about interactive vs non-interactive behavior (neither does the sh man page, as a matter of fact), so Brian just exited the shell after a bad substitution like that. I `fixed' it to mimic the sh behavior (`do what I do, not what I say'), and that's the code Brian is running now. This is the full description from the System V sh manual: ${parameter:?word} "If `parameter' is set and is non-null, substitute its value; otherwise, print `word' and exit from the shell. If `word' is omitted, the message `parameter null or not set' is printed." Chet Ramey -- Chet Ramey Network Services Group "Help! Help! I'm being Case Western Reserve University repressed!" chet@ins.CWRU.Edu