Solved

Unix shell syntax error

Posted on 2006-07-07
4
2,803 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Adapt this command to show who installed 29 108
Error on moodle after upgrade 3 130
haveThree challenge 22 118
canBalance challenge 34 81
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

776 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