in reply to perl and linux

To execute a perl script without using perl blah.pl: first make sure the file has execute permissions (chmod 0700), then maker sure your PATH includes ./ (if it don't: add it to your /home/username/.bash_profile, PATH=./:/usr/bin:...). To install a module look at this guide written by tachyon in the Tutorials Section.

"Pain is weakness leaving the body, I find myself in pain everyday" -me

Replies are listed 'Best First'.
Re: Re: perl and linux
by vek (Prior) on Oct 26, 2003 at 17:28 UTC

    Or if a user other than your good self needs to execute the program, chmod 0755

    -- vek --

      Like the web server for instance...... :-)

      cheers

      tachyon

      s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Re: Re: perl and linux
by {NULE} (Hermit) on Oct 27, 2003 at 15:05 UTC
    Typically ./ is excluded from the path for security reasons. Probably not a big deal in this case (there are more single user, a.k.a. desktop, machines running linux these days than multi-user servers per se). But say on a multi-user machine, some mischevious user creates a bash script called "ls" and puts it in some group writable directory that you do much work in. According to your PATH that ls would be called before the real ls and it would do whatever that mischevious person created it to do. For example, mail your ssl private key to themselves, or /etc/shadow if you foolishly have ./ in your path as root. Of course, their script would then call the real ls then delete itself and you would be none the wiser.

    Anyway, I'm not picking on your advice, I would just like people to be aware that ./ is excluded from the path for a very good reason. If you just get used to typing ./program.pl now, you might save yourself problems in the future.

      Okay all you people are right, I forgot he said it was networked. Okay forgot isn't the right word, I have been setting up Linux machines for the past few weeks, all single user or small group of user machines, so I just put the steps I used to make my scripts work.

      Don't use ./ in the path and use 0755 so others can use your scripts, if you want them to (but remember root can see all ;)

      "Pain is weakness leaving the body, I find myself in pain everyday" -me

Re: Re: perl and linux
by Anonymous Monk on Oct 26, 2003 at 16:39 UTC
    thanx