Solved

Unix shell syntax error

Posted on 2006-07-07
4
2,802 Views
Last Modified: 2013-12-26
Hi all,

I'm quite new to UNIX shell scripting and need some explanation of an error I'm getting. I've got quite a good grasp of vbScript within Windows but I can't see what's wrong here.

This is the error message: -

script.sh[51]: syntax error at line 68 : `"' unmatched

Here's te section of the script in question: -

ll $RunColDir/*CITI*
if [ $? != 0 ]
        then echo " There are no files to process in $RunPayDir " # this is line 68
       exit 5
fi

If anyone has any good web site resources for learning UNIX shell programming can you let me know.

Thanks in advance.
0
Comment
Question by:mass2612
  • 2
4 Comments
 
LVL 51

Accepted Solution

by:
ahoffmann earned 500 total points
ID: 17057386
there is most likel an unmatchd " before line 68
0
 
LVL 29

Author Comment

by:mass2612
ID: 17057730
Thanks ahoffmann. You were on the money. Would you recommend any sites or books for learning to script via the shell in more detail? I've got a good understanding of basic command and would like to know more.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 17059512
there're too much books about that, best you're going to a book store and compare some of them
IIRC there is one from Edison-Wesley simply named Unix Shells which covers the common ones.
0
 
LVL 1

Expert Comment

by:tacticalvehicle
ID: 17060492
When I trie identify you problem
I have to say somethink

on UNIx is many shells each have some futures and dis-advatages
some unix shell are  small and fast but with very sesitive on  on scipting syntax

budg  can be earlier than this but bad quotation or semicolon also missing somewhere
that's my intro
----------------------------------------
now back to your problem from data which you provide,,..

$ cat test.sh

#!/bin/bash
# also ksh should working I know problem with sh-posix or ash
ls -la .                                                           # your command
if [ $? -eq 0 ]; then                                         # -eq isnt same as = man ksh  ( value and string )
   echo "ll cmd working fine";                           # if is $? = 0 everythink is fine
else
   echo " There are no files to process in ";       # if is $? not equal 0 - ohmm... Houston we have poroblem...
-----------------------------------------------------------------------------------------------------------------------------------
executed my script
$test.sh

total 4
drwxr-xr-x 2 tactical  None   0 Jul  7 19:31 .
drwxr-xr-x 7 tactical  None   0 Jan  1  1970 ..
-rw-r--r-- 1  tactical   None 113 Jul  7 19:34 test.sh
ll cmd working fine

$ echo $SHELL
/bin/bash


0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Replacement selected text 2 58
sameEnds challenge 3 134
matchUp  challenge 6 53
Thin secure Windows 10 5 75
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now