Sponsored Content
Top Forums Shell Programming and Scripting Is Rule 7 of POSIX shell grammar rules written correctly? Post 302978853 by bakunin on Thursday 4th of August 2016 06:45:31 PM
Old 08-04-2016
Quote:
Originally Posted by Mark_Galeck
2. Rule 7a for the first word, in some cases refers to Rule 7b, which is labeled "not the first word". Is that a misleading label ?
No. Consider the following: you have an executable called "foo=bar", which is a valid name for a file. What would these lines do:

Code:
# cat foo=bar
echo "hello world"

# ./foo=bar
??

# typeset foo=bar
??

# x=$(foo=bar)
??

# foo=bar
??

Would it assign the value "bar" to a variable "foo" or would it execute the command foo=bar?

Quote:
Originally Posted by Mark_Galeck
3. The yacc symbol cmd_word refers to rule 7b, which says, if the word contains '=' after its first character, then it is an assignment - and not anything to do with a command. Should rule 7b simply state that it is not allowed to have '=' after the first character?

4. Rule 7a is only referenced during parsing simple commands, which cannot have any reserved words in them. Yet Rule 7a in some cases refers to Rule 1, which differentiates between a reserved word and ordinary word.
And all this deals with similar situations. That may seem pretty picky, but when designing a language you cannot assume that one only uses things that make sense at first glance.

I hope this helps.

bakunin
This User Gave Thanks to bakunin For This Post:
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Simple shell script to be written

There are 2 shell script files sh1 and sh2. sh2 contains records such as 01 02 03 on different lines. In sh1, I would like to read each record of sh2 till end of file, concatenate them with a comma(,) and store in a variable. Can somebody please help me with the sh1 script? Thanks in... (2 Replies)
Discussion started by: shsandeep
2 Replies

2. Shell Programming and Scripting

Simple shell script to be written

There are 2 shell script files sh1 and sh2. sh2 contains records such as 01 02 03 on different lines. In sh1, I would like to read each record of sh2 till end of file, concatenate them with a comma(,) and store in a variable. Can somebody please help me with the sh1 script? Thanks in... (6 Replies)
Discussion started by: shsandeep
6 Replies

3. Shell Programming and Scripting

what's the largest shell script you've ever written?

I've just written a test harness using ksh. One of scripts weighed in at 1206 lines. I came across Eric Raymonds 'Art of Unix programming' on line and he advises against excessively large scripts. I am very interested to hear people's opinions on this and any experiences they have had. (2 Replies)
Discussion started by: OFFSIHR
2 Replies

4. UNIX for Dummies Questions & Answers

can a korn shell script be written on HP-UNIX?

Is HP UNIX and Korn different flavours of unix? can a korn shell script be written on HP Unix? (4 Replies)
Discussion started by: soujanya_srk
4 Replies

5. Solaris

Jumpstart -- Warning: Could not find matching rule in rules.ok

I just setup a new jumpstart server, and I'm having problems with rules.ok errors. I'm coming up blank after many Google searches, forum searches, etc..... This is the error I receive: Skipped interface e1000g1 Attempting to configure interface e1000g0... Configured interface e1000g0... (0 Replies)
Discussion started by: christr
0 Replies

6. Programming

How could I interact with shell script from webportal written in php?

Hello, I am new on PHP scripting .I have shell scripts which I an running currently from linux server but now I want to make a web portal from where I will run all my scripts but the problem is all my scripts ask for parameters so I am getting confused how could I run my shell script from web... (2 Replies)
Discussion started by: anuragpgtgerman
2 Replies

7. Shell Programming and Scripting

Shell grammar question: logical OR in test

Hi, I am trying to check if two input files exist before the rest of the scripts is run. Following is the code that I have but it gives me syntax error. if then echo "File not found" else echo "File found" fi (3 Replies)
Discussion started by: nua7
3 Replies

8. Shell Programming and Scripting

Pure POSIX shell scripting...

Hi all... This is more of a concensus question than help... As many of you know I am experimenting with the limitations of Pure POSIX shell scripting. Q: Is the directory /bin considered part of the Pure POSIX shell or must I stick entirely with the builtins only? The reason is I... (2 Replies)
Discussion started by: wisecracker
2 Replies

9. Shell Programming and Scripting

Equivalent to let command in POSIX shell

Hi all, I am learning POSIX shell programming, and the book I read, uses the let command for integer arithmetic. I have downloaded and use the shellcheck program on Linux. This programs says: In POSIX sh, 'let' is undefined. See the screenshot attached. What is the POSIX... (1 Reply)
Discussion started by: johnprogrammer
1 Replies
FINDORULE(1p)						User Contributed Perl Documentation					     FINDORULE(1p)

NAME
findorule - command line wrapper to File::Find::Object::Rule USAGE
findorule [path...] [expression] DESCRIPTION
"findorule" mostly borrows the interface from GNU find(1) to provide a command-line interface onto the File::Find::Object::Rule heirarchy of modules. The syntax for expressions is the rule name, preceded by a dash, followed by an optional argument. If the argument is an opening parenthesis it is taken as a list of arguments, terminated by a closing parenthesis. Some examples: find -file -name ( foo bar ) files named "foo" or "bar", below the current directory. find -file -name foo -bar files named "foo", that have pubs (for this is what our ficticious "bar" clause specifies), below the current directory. find -file -name ( -bar ) files named "-bar", below the current directory. In this case if we'd have omitted the parenthesis it would have parsed as a call to name with no arguments, followed by a call to -bar. Supported switches I'm very slack. Please consult the File::Find::Object::Rule manpage for now, and prepend - to the commands that you want. Extra bonus switches findorule automatically loads all of your installed File::Find::Object::Rule::* extension modules, so check the documentation to see what those would be. AUTHOR
Richard Clamp <richardc@unixbeard.net> from a suggestion by Tatsuhiko Miyagawa Adapted to File::Find::Object::Rule by Shlomi Fish (all copyrights disclaimed). COPYRIGHT
Copyright (C) 2002 Richard Clamp. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
File::Find::Object::Rule perl v5.14.2 2012-05-05 FINDORULE(1p)
All times are GMT -4. The time now is 01:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy