![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| AWK syntax question | Leo_NN | UNIX for Dummies Questions & Answers | 5 | 10-28-2008 12:18 PM |
| egrep syntax question | DKNUCKLES | Shell Programming and Scripting | 1 | 11-18-2007 04:46 PM |
| Simple Awk Question: If Syntax | natdeamer | Shell Programming and Scripting | 1 | 09-10-2007 01:53 PM |
| yet another awk field syntax question | prkfriryce | Shell Programming and Scripting | 4 | 03-22-2007 01:13 PM |
| awk syntax question | hcclnoodles | Shell Programming and Scripting | 2 | 10-28-2004 01:45 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Question regarding syntax of (lis) and { list;}
Hi there,
As you know, we can group a list of commands in either (list) form or { list;}. I know the difference between the two. (list) make the command list to be executed in a subshell while the commands gathered in { list;} are executed in the current shell. My question here is about the syntax. You see, for (list), it is not required to insert a space between ( and list. But it is required for { list;}. The man page for ksh says { is a keyword and that is why there must be a white space b/w { and list. Then ( is not a keyword? If no, what ( should be called? Also, the list in { list; } is required to end with ';'. What does it mean? Why the shell is designed this way? I know it is not easy to be clarified but hopefully here is someone insightful in these things ![]() |
|
|||||
|
In ksh, '{' and '}' are reserved words not keywords. The space after the opened '{' in { list;} is simply a way of providing additional information to the ksh parser to allow it correctly parse the statement.
If you want a more detailed understanding, you will need to look at the ksh93 source code which is freely available at AT&T Software Download. The relevant files are ../cmd/ksh93/sh/expand.c and ../cmd/ksh93/sh/lex.c |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|