Solved

Unix shell syntax error

Posted on 2006-07-07
4
2,801 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
Comment Utility
there is most likel an unmatchd " before line 68
0
 
LVL 29

Author Comment

by:mass2612
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

743 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

13 Experts available now in Live!

Get 1:1 Help Now