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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
04-21-2002, 12:55 PM
|
#1
|
LQ Newbie
Registered: Apr 2002
Location: Paris
Distribution: Mandrake 8.1
Posts: 11
Rep:
|
csh
Just a little message concerning something quite puzzling that happended to me : I'm working with csh shells and had to install
Mandrake 8.1 on two different computers. On one of them, I can call the csh scripts simply by their name and on the other one I need to put the ./ sign before the name, otherwise it says something like bad interpreter.
Has anyone an idea why it's happening ,
sandrine (puzzled)
|
|
|
04-23-2002, 09:40 AM
|
#2
|
LQ Newbie
Registered: Apr 2002
Location: Paris
Distribution: Mandrake 8.1
Posts: 11
Original Poster
Rep:
|
csh
What really happens is that when I log in the first time, I cannot launch a csh script without the ./ before the name of the script.
Then, I change the shell with the command chsh -s /bin/csh username,
andd I have to log in again so that the changes are taken into account...
Is there a file that I can configure so that I don't need to log in again everytime I want my scripts to be executed correctly ?
Thanks
|
|
|
04-24-2002, 06:07 AM
|
#3
|
Senior Member
Registered: Dec 2001
Location: The Netherlands
Distribution: Ubuntu
Posts: 1,316
Rep:
|
Some things you might want to check:
To be able to execute files in the current directory without the ./ then you either have to add the directory to your path or add . to the path.
Make sure the user who is trying to start it has execute permissions on the script. Only read permissions sometimes gives the message "bad interpreter".
Also make sure the first line of the script looks like this:
#!/bin/csh
|
|
|
04-24-2002, 01:46 PM
|
#4
|
Member
Registered: Apr 2002
Location: Denver
Distribution: SuSe,RedHat,Mandrake,
Posts: 109
Rep:
|
Hi, I'm not trying to discourage you from placing your current directory (.) in your path, but some will consider it to be a security breach. The reason for this is that when your current directory is not in your path, then some Linux distros force you to enter it prior to executing a script. Say you decide to add the current directory to your path, and for some reason someone tampers into your system and places a script ( for malicious purpose ) and names it, say , cd . We both know that cd is a Linux command, but here is the kicker. Since the "bad" script is named cd, and assuming the current directory is defined in the PATH, then Linux will execute the script and not the actual command. I personally don't mind taking the extra key strokes to put ./ for executing my scripts.
Last edited by abrakadabra; 04-24-2002 at 01:48 PM.
|
|
|
05-07-2002, 03:44 AM
|
#5
|
LQ Newbie
Registered: Apr 2002
Location: Paris
Distribution: Mandrake 8.1
Posts: 11
Original Poster
Rep:
|
Thanks, I see what you mean but the thing is that even in my current directory I have to specify ./ before a script so that it is interpreted...
|
|
|
05-07-2002, 09:43 AM
|
#6
|
Member
Registered: Apr 2002
Location: Denver
Distribution: SuSe,RedHat,Mandrake,
Posts: 109
Rep:
|
My point exactly! If the current directory is not defined in PATH then one must type ./ before a script. What typing ./ does is " Ok shell, look in the current directory . / and find script [script] and execute" when current directory is defined in PATH then this is what you are doing " Ok shell you already know to look in the current directory (. already defined in PATH) exeucte script [script]"
|
|
|
05-21-2002, 07:26 AM
|
#7
|
LQ Newbie
Registered: Apr 2002
Location: Paris
Distribution: Mandrake 8.1
Posts: 11
Original Poster
Rep:
|
thanks a lot for your help. It did help
Sandrine
|
|
|
All times are GMT -5. The time now is 05:44 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|