LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 10-05-2007, 02:08 AM   #1
jmgm
LQ Newbie
 
Registered: Oct 2007
Posts: 6

Rep: Reputation: 0
shell script


Hi,

I have a Red hat server where I'm trying to execute diferents shell scripts, but I am not able to do this.

A simple shell script that I try to execute is this:

#!/bin/ksh
JBOSS_HOME=/home/jboss/jboss-4.0.2
export JBOSS_HOME
echo $JBOSS_HOME
ls -al /home/jboss/jboss-4.0.2
ls -al /home/jboss/jboss-4.0.2/server/nps-tempo/log/*

rm /home/jboss/jboss-4.0.2/server/nps-tempo/log/*



(the folder "log" exists)
When I execute:
...]$ start_NPS-tempo_temp.sh
the result is:
: bad interpreter: The file or the directory does not exist


When I execute:
...]$ ksh start_NPS-tempo_temp.sh
the result is:
/home/jboss/jboss-4.0.2
: The file or the directory does not exist
: The file or the directory does not exist-tempo/log/*
: not foundempo_temp.sh[7]:
rm: it is not possible to be erased «/home/jboss/jboss-4.0.2/server/nps-tempo/log/*\r»: The file or the directory does not exist



I have tried to put #!/bin/sh where I have #!/bin/ksh

but the result is similar

I don't understand who is the problem.

Can you help me? thanks
 
Old 10-05-2007, 02:23 AM   #2
simonwelch
LQ Newbie
 
Registered: Jan 2007
Location: Shropshire, United Kingdom
Distribution: RHEL, Fedora, Ubuntu
Posts: 4

Rep: Reputation: 0
It sounds like you have created the script on a Windows PC and then copied to server so file is in the wrong format. Open the script in vi and then press Esc, press :, then enter set ff=unix and then press : again and enter wq. This will convert the file to unix format and remove any unwanted control characters from the end of line.

Best of luck

Simon
 
Old 10-05-2007, 02:29 AM   #3
jmgm
LQ Newbie
 
Registered: Oct 2007
Posts: 6

Original Poster
Rep: Reputation: 0
Thanks 4 ur reply, now it works
 
  


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
Shell script inside shell script treotan Linux - General 4 02-19-2009 06:34 AM
Shell Scripting: Getting a pid and killing it via a shell script topcat Programming 15 10-28-2007 02:14 AM
I made a shortcut to a shell script and it is using default shell icon... shlinux Linux - Software 2 04-20-2006 06:29 AM
Alias or shell script to confirm 'exit' commands from a shell rose_bud4201 Programming 2 03-08-2006 02:34 PM
shell script problem, want to use shell script auto update IP~! singying304 Programming 4 11-29-2005 05:32 PM

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

All times are GMT -5. The time now is 11:12 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