LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices

Reply
 
Search this Thread
Old 10-26-2004, 11:46 AM   #1
Bubba235
LQ Newbie
 
Registered: Oct 2004
Posts: 5

Rep: Reputation: 0
Redhat AS 3, shell/script question


When trying to run a backup script titled hotbackup.sh it gives an error: bash: hotbackup.sh: command not found. If I run sh hotbackup.sh it runs fine. The 1st line of the script is #!/bin/ksh and I verified that the path is correct. I have tried changing this to bin/sh or #!/bin/bash with no help, same error. Again, if I type sh before the name of the script, it runs fine. Does anyone know a solution to this? Sorry if this is a newbie type question.
Any help would be greatly appreciated.
Thank you.
 
Old 10-26-2004, 11:57 AM   #2
chort
Senior Member
 
Registered: Jul 2003
Location: Silicon Valley, USA
Distribution: OpenBSD 4.6, OS X 10.6.2, CentOS 4 & 5
Posts: 3,660

Rep: Reputation: 69
Yes:
$ chmod ug+x hotbackup.sh
(you could just do chmod +x hotbackup.sh if you want everyone to be able to execute it)

If you've already confirmed that it's executable, then you need to specify the path to it because it's not in your environment. If you're in the same directory, do:
$ ./hotbackup.sh
if you're not in the same directory, do:
$ /path/to/yourfile/hotbackup.sh

If you're root, you should absolutely not add . to your PATH environment, because that can be used to easily trick the root user into running trojaned commands.
 
Old 10-26-2004, 12:15 PM   #3
Bubba235
LQ Newbie
 
Registered: Oct 2004
Posts: 5

Original Poster
Rep: Reputation: 0
Smile

I did have execute permissions and you were absolutely right about the path. Thank you for the help, you rock!
 
  


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 question Whiteghost Programming 17 09-10-2005 06:52 PM
Another shell script question J_Szucs Programming 4 09-10-2005 02:47 PM
Shell script question. pete1234 Programming 10 09-06-2005 02:46 AM
Shell Script Question. rvijay Linux - General 2 07-14-2005 06:41 PM
Shell script question rytrom Linux - Newbie 4 01-28-2004 07:20 AM


All times are GMT -5. The time now is 04:19 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration