The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



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

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-21-2009
hongwei hongwei is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 6
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
  #2 (permalink)  
Old 04-22-2009
fpmurphy's Avatar
fpmurphy fpmurphy is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2003
Location: Florida
Posts: 1,930
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
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 01:02 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0