LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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 08-04-2003, 05:25 AM   #1
greendemon
LQ Newbie
 
Registered: Jul 2003
Location: Reading, UK
Posts: 22

Rep: Reputation: 15
running commands ./ ??


A trivial thing..

Why do I have to put in "./" preceeding a script? Is there a way to avoid this?
 
Old 08-04-2003, 05:37 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,415

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
because your current directory is not on your path, and it never ever should be. the only *good* way to not have to do that is to move the script to a program directory, e.g. /usr/local/bin
 
Old 08-04-2003, 08:28 AM   #3
lfur
Member
 
Registered: Jul 2003
Location: Slovenia
Distribution: Slackware & FreeBSD
Posts: 209

Rep: Reputation: 30
acid_kewpie,

why is that? I read somewhere, that it is goot to remove :.: form roots path - so it cannot accidentally run some programs (is that true?). But why not use . in user path?

Thanks
 
Old 08-04-2003, 08:37 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,415

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
because it doesn't make sense to be able to run only certain programs when you are in a particular directory... that's just illogical. It can also get very confusing.... what if you create a shell script "blah" to test and work on but you already have a progrma called "blah" installed on your system.... how do you know which one is running etc...?
 
Old 08-04-2003, 10:54 AM   #5
stickman
Senior Member
 
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
The main problem with putting . in your path (especially at the beginning) is that is opens you up to possible security problems. A user could put a trojan script in their home directory called file or ls hoping that when the admin would run it when they were checking to see just what was taking up so much space in the users directory. If . was in the PATH before the real binary, the the trojan could get run instead. Another trick is to scatter common command mispellings around the system.
 
  


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
Running Commands blazted Linux - Newbie 6 11-13-2004 04:49 PM
Automatically running commands azebuski Linux - Newbie 3 02-11-2004 10:36 PM
Running commands linuxnewbie001 Linux - Newbie 6 08-01-2003 05:28 PM
Running commands on bootup robeb Linux - General 7 08-11-2002 09:02 PM
automatically running commands... lhoff Linux - General 9 02-21-2002 03:34 PM


All times are GMT -5. The time now is 11:53 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration