LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-27-2012, 04:48 PM   #1
jimblim
LQ Newbie
 
Registered: Mar 2012
Posts: 6

Rep: Reputation: Disabled
unexpectedksh:----Error received


I am new to Linux. We have a server that is used primarily for ssh but would like to add running some ksh scripts. I am running one but am getting this error: ' unexpectedksh: line 87: syntax error at line 90: `in



line 87=ARS_OPTS=$@
line 90=case "$1" in

THIS IS THE CODE:


ARS_OPTS=$@
while [ $# -gt 0 ]
do
case "$1" in
-h|-\?) #display help info and exit
Usage;;
-s) #severity
SEVERITY=$2; shift; shift;;
-g) #assignment group
GROUP=$2; shift; shift;;
-d) #description
DESC=$2; shift; shift;;
-c) #config file
ARS_CONFIGFILE=$2; shift; shift;;
-*) #invalid options - show error and exit
echo "Invalid option: $1 use -h for help"; exit 1;;
*) #notes (stick everything else in notes)
ARS_NOTES="$ARS_NOTES $1"; shift;;
esac
done


Any ideas?
 
Old 03-27-2012, 06:59 PM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,258

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
Difficult to tell from that; try putting
Code:
set -xv
as the 2nd line of your code (ie after the #!/bin/ksh line).
This shows what the parser is doing ie the 'before' & 'after' parsing of each line; very good for debugging.
Also, next time, please use code tags when posting https://www.linuxquestions.org/quest...do=bbcode#code to preserve formatting & makes it easier to read.
 
1 members found this post helpful.
Old 03-28-2012, 02:28 AM   #3
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 8,505

Rep: Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434
usually you have something mistyped before line 87....
 
1 members found this post helpful.
Old 03-29-2012, 04:29 PM   #4
jimblim
LQ Newbie
 
Registered: Mar 2012
Posts: 6

Original Poster
Rep: Reputation: Disabled
Thanks for your help! I did a od on the file. It contained \r\n...Removed the \r...Works now..
 
Old 03-29-2012, 07:22 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,258

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
If you did that manually, you may like to know about this http://linux.die.net/man/1/dos2unix; very handy when there's a lot to fix and/or you want to automate it.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I Received a Weird Error ... Tell Me What It Means taurusx5 Linux - Software 2 06-12-2008 10:21 AM
Received Grub Error 18 on boot up. vinrod Linux - Software 6 03-15-2008 11:45 PM
error received when i plug in my usb Unregistered Slackware 1 11-11-2007 09:16 AM
Error received IP information failed jimnunn Linux - Hardware 1 10-15-2007 05:16 AM
Error message received from system Error while reading filter description for true Steel_J Linux - Software 2 03-04-2006 07:10 PM


All times are GMT -5. The time now is 10:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration