LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 04-21-2002, 11:55 AM   #1
zaza
LQ Newbie
 
Registered: Apr 2002
Location: Paris
Distribution: Mandrake 8.1
Posts: 11

Rep: Reputation: 0
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)
 
Old 04-23-2002, 08:40 AM   #2
zaza
LQ Newbie
 
Registered: Apr 2002
Location: Paris
Distribution: Mandrake 8.1
Posts: 11

Original Poster
Rep: Reputation: 0
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
 
Old 04-24-2002, 05:07 AM   #3
Mik
Senior Member
 
Registered: Dec 2001
Location: The Netherlands
Distribution: Ubuntu
Posts: 1,316

Rep: Reputation: 47
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
 
Old 04-24-2002, 12:46 PM   #4
abrakadabra
Member
 
Registered: Apr 2002
Location: Denver
Distribution: SuSe,RedHat,Mandrake,
Posts: 109

Rep: Reputation: 16
Lightbulb

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 12:48 PM.
 
Old 05-07-2002, 02:44 AM   #5
zaza
LQ Newbie
 
Registered: Apr 2002
Location: Paris
Distribution: Mandrake 8.1
Posts: 11

Original Poster
Rep: Reputation: 0
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...
 
Old 05-07-2002, 08:43 AM   #6
abrakadabra
Member
 
Registered: Apr 2002
Location: Denver
Distribution: SuSe,RedHat,Mandrake,
Posts: 109

Rep: Reputation: 16
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]"

 
Old 05-21-2002, 06:26 AM   #7
zaza
LQ Newbie
 
Registered: Apr 2002
Location: Paris
Distribution: Mandrake 8.1
Posts: 11

Original Poster
Rep: Reputation: 0
thanks a lot for your help. It did help

Sandrine
 
  


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
Getting csh on cygwin saiz66 Linux - Newbie 0 09-16-2004 09:14 AM
looking for csh or tcsh help 1ernie Linux - Software 1 04-12-2004 05:43 PM
csh problem !! StephP Linux - Newbie 1 11-14-2003 05:19 AM
Path in csh sstrause Linux - Newbie 2 03-10-2003 02:56 PM
Csh or Bsh max_linuxquesti Programming 4 12-26-2002 01:17 PM

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

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