$NetBSD: t4,v 1.3 2010/08/22 02:19:07 perry Exp $ Copyright (C) Caldera International Inc. 2001-2002. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code and documentation must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. All advertising materials mentioning features or use of this software must display the following acknowledgement: This product includes software developed or owned by Caldera International, Inc. Neither the name of Caldera International, Inc. nor the names of other contributors may be used to endorse or promote products derived from this software without specific prior written permission. USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA INTERNATIONAL, INC. AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CALDERA INTERNATIONAL, INC. BE LIABLE FOR ANY DIRECT, INDIRECT INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) RISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @(#)t4 8.1 (Berkeley) 8/14/93.bp
Appendix A - Grammar
Note: This grammar needs updating, it is obsolete.
item: word
input-output
name = value
simple-command: item
simple-command item
command: simple-command
( command-list )
{ command-list }
for name do command-list done
for name in word \*(ZZ do command-list done
while command-list do command-list done
until command-list do command-list done
case word in case-part \*(ZZ esac
if command-list then command-list else-part fi
pipeline: command
pipeline \*(VT command
andor: pipeline
andor && pipeline
andor \*(VT\*(VT pipeline
command-list: andor
command-list ;
command-list &
command-list ; andor
command-list & andor
input-output: > file
< file
\*(AP word
\*(HE word
file: word
& digit
& -
case-part: pattern ) command-list ;;
pattern: word
pattern \*(VT word
else-part: elif command-list then command-list else-part
else command-list
empty
empty:
word: a sequence of non-blank characters
name: a sequence of letters, digits or underscores starting with a letter
digit: 0 1 2 3 4 5 6 7 8 9
.bp
Appendix B - Meta-characters and Reserved Words
a) syntactic
\*(VT 6
pipe symbol
&& 6
`andf' symbol
\*(VT\*(VT 6
`orf' symbol
; 8
command separator
;; 8
case delimiter
& 8
background commands
( ) 8
command grouping
< 8
input redirection
\*(HE 8
input from a here document
> 8
output creation
\*(AP 8
output append
b) patterns
\*(ST 8
match any character(s) including none
? 8
match any single character
[...] 8
match any of the enclosed characters
c) substitution
${...} 8
substitute shell variable
$(...) 8
substitute command output
\`...\` 8
substitute command output
$((...)) 8
substitute arithmetic expression
d) quoting
\e 8
quote the next character
\'...\' 8
quote the enclosed characters except for \'
"..." 8
quote the enclosed characters except
for
$ \` \e "
e) reserved words
if then else elif fi
case in esac
for while until do done
! { }