LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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, 03: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, 03: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, 03:29 AM   #3
jmgm
LQ Newbie
 
Registered: Oct 2007
Posts: 6

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


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


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