473,395 Members | 1,532 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

scripts execute while in /bin, but not anywhere else

I'm teaching myself UNIX, here, and I've written a shellscript that works fine if I use it while in the /bin directory, but if I try to use it from another directory, I get 'command not found'.

echo $PATH shows me the /bin folder
find shows me that the script is actually in that folder
my .cshrc file has its PATH set to that folder

I don't know what's going wrong. I have a script that someone else wrote that seems to work fine wherever it's used (though I don't want to test that, as it's a script that dumps the contents of the ls file onto someone else's screen - not very nice. My friend wrote it to show me scripting, and has a rather retaliatory sense of humour). but I can't see any difference between the basics of his script and mine.

Please help? I wouldn't be surprised if this is some really stupid error (it's what generally happens when you're teaching yourself) but I can't figure it out.
Jun 22 '07 #1
4 2006
prn
254 Expert 100+
Hi Avaenuha,

The key information you have given us is that
echo $PATH
shows /bin (but evidently not anything else). Your problem looks to be that you are not looking anywhere else for your script. If, for example, your script is in /home/Avaenuha then you could run it with /home/Avaenuha/scriptname. Or, as another possibility, you could add a line like

setenv PATH $PATH:$HOME

to your .cshrc file, which will make your csh command interpreter look for scripts in your $HOME directory as well as in your previous PATH.

HTH,
Paul
Jun 22 '07 #2
archonmagnus
113 100+
Try using the "sh" command like so:
Expand|Select|Wrap|Line Numbers
  1. sh <scriptname>
  2.  
"sh" is a shell interpreter and so parses the input file as a script. "sh" is in the /bin path, so it can be used in any directory with a script in it.
Jun 22 '07 #3
Try using the "sh" command like so:
Expand|Select|Wrap|Line Numbers
  1. sh <scriptname>
  2.  
"sh" is a shell interpreter and so parses the input file as a script. "sh" is in the /bin path, so it can be used in any directory with a script in it.
Thanks for your help, that's sorted it out.
Jul 2 '07 #4
Motoma
3,237 Expert 2GB
I think the most likely case, judging by the solution, was that the permissions on the shell script were not set to execute.
Jul 2 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Jon Cosby | last post by:
I'm having trouble executing Python scripts in IIS. I have the error message "%1 is not a valid Win32 application". Anyone know what this is about? Jon Cosby
6
by: windozbloz | last post by:
Bye Bye Billy Bob... Hello All, I'm a fairly literate windoz amateur programmer mostly in visual basic. I have switched to SuSE 9.2 Pro and am trying to quickly come up to speed with Python...
8
by: Leszek | last post by:
Hi. Could you help solve the problem: i have a file that has two includes: //my script <?php include(.'/prog1.php'); include(.'/prog2.php'); ?>
17
by: John Salerno | last post by:
Ok, I've been browsing through the MySQLdb docs, and I *think* I know the kind of code I need to write (connect, cursor, manipulate data, commmit, etc. -- although I probably need to get more...
31
by: Manfred Kooistra | last post by:
If I have a document like this: <html> <head> <script language=javascript> window.location.href='file.php'; </script> </head> <body> body content
1
by: =?Utf-8?B?TGVvbiBNYXluZQ==?= | last post by:
In a database project in VS2005 (not a datadude project), I need to add about 3,000 stored procedure scripts to my 'Stored Procedures' folder. I've dropped the scripts into the folder in my...
3
by: joe jacob | last post by:
I configured apache to execute python scripts using mod_python handler. I followed below mentioned steps to configure apache. 1. In http.conf I added <Directory...
2
by: raghutumma | last post by:
Hi, How can we execute SQL Scripts using Batch file??? i think Batch file should contain Username,Password,Database and Scripts... Using that file scripts should run... How can i give...
3
by: mdshafi01 | last post by:
Hello, My problem is i want to execute many perl programs but i do do not want to wait for for any of these programs. Let these programs execute independently. i have totally 10 perl scripts. I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.