LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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, 03: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, 05:59 PM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,369

Rep: Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753
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, 01:28 AM   #3
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,039

Rep: Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347Reputation: 7347
usually you have something mistyped before line 87....
 
1 members found this post helpful.
Old 03-29-2012, 03: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, 06:22 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,369

Rep: Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753
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



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 09:21 AM
Received Grub Error 18 on boot up. vinrod Linux - Software 6 03-15-2008 10:45 PM
error received when i plug in my usb Unregistered Slackware 1 11-11-2007 08:16 AM
Error received IP information failed jimnunn Linux - Hardware 1 10-15-2007 04:16 AM
Error message received from system Error while reading filter description for true Steel_J Linux - Software 2 03-04-2006 06:10 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:26 AM.

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
Open Source Consulting | Domain Registration