syntax and semantic check


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers syntax and semantic check
# 1  
Old 03-30-2004
syntax and semantic check

Does the shell perform a syntax and semantic check before commands are sent to the kernel?

Ravioli
# 2  
Old 03-30-2004
You can have the interpretor check your syntax (Korn) by adding one of the following lines below the "magic number" in your script. Also note that the options can be enabled or disabled by using (+) or (-) signs.

set -x (Show commands and arguments during execution)
set -n (Read the commands but dont execute - syntax check)

see man set
# 3  
Old 03-30-2004
So they at least are checked for syntax before they are sent to the Kernel. Does this mean they are compiled in the shell as well?

Ravioli
# 4  
Old 03-30-2004
set is a built in shell function.

Code:
NAME
     set, unset, setenv, unsetenv, export - shell built-in  func-
     tions  to  determine  the  characteristics for environmental
     variables of the current shell and its descendents

its for sh/ksh/csh shells.

it is checked for syntax only if you "set" the proper switches.

otherwise it is just sent as is and will error out if there is an error.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with Check Syntax of Shell Script without Running

Hi Everyone, Is there any way ( generic) to check syntax of Shell Scripts without running it?? (4 Replies)
Discussion started by: roy121
4 Replies

2. Shell Programming and Scripting

Shell script check syntax not working ...

Hello i have question that i want check syntax from my script shell with sh -n filename but it's not show something even i have wrong syntax in my file. why can this happened or any other way to check it? i use on header of file : #!/bin/sh thx before :) (7 Replies)
Discussion started by: Gochengz
7 Replies

3. Programming

Need hep with my semantic error

while(EOF != (c = fgetc(filePtr))) { if ((c == ' ') || (c == '\n') || (c == '\0')) { if (c == '\0') { continue; } printf("%s",cc); printf("%c\n"); memset(cc, 0, sizeof cc); } else { cc=c; i++; } (5 Replies)
Discussion started by: fwrlfo
5 Replies

4. Shell Programming and Scripting

CHECK SCRIPT SYNTAX

Hi everyone, i'd like someone chechk this script, i know it's very simple but it doesn't work good, let me tell you this script works over huge directories, maybe that's the problem, if somebody can give me other way to develop, or show me where it's the problem, i'll appreciate it. ... (9 Replies)
Discussion started by: Newer
9 Replies

5. Shell Programming and Scripting

How to Check Shell script syntax w/o executing

Hello All, I looking for a way to verify the correction of shell script syntax. Is there any switch like -c in perl which do this in shell ? Thank You. (1 Reply)
Discussion started by: Alalush
1 Replies

6. UNIX for Dummies Questions & Answers

quick check of my awk syntax

I've made an awk command that works successfully. However I'd like to add one character to it. For example instead of /what_i_have_now/ I'd like to change just ONE field to the opposite with an exclamation point. Like this: ! /what_i_have_now/ My question, where am I supposed to place... (1 Reply)
Discussion started by: yongho
1 Replies
Login or Register to Ask a Question