Skip to Main Content
Perl for Web Site Management
book

Perl for Web Site Management

by John Callender
October 2001
Beginner content levelBeginner
528 pages
15h 20m
English
O'Reilly Media, Inc.
Content preview from Perl for Web Site Management

The Dot Slash Thing

The next step is to try running the script by entering its name at the Unix command prompt. You may be able to do this by just entering the name of the script (hello.plx) all by itself. Or you may need to precede its name by a period and a forward slash (./). What decides this is whether the dot (.), which you will recall is a shortcut for the current working directory (meaning the directory you are currently in), is in your command path.

The command path is just a list of directories that the shell looks in to find the command whose name you entered. On a DOS system, the current working directory is in your command path by default, but not so under Unix.

If the current working directory isn’t in your command path, entering hello.plx by itself at the shell prompt will not work because the Unix shell will not be able to find the script, even though it’s right there. Instead, you’ll have to enter ./hello.plx, with that initial dot slash (./) telling the Unix shell to look in the current working directory for the command whose name you’re typing in.

Tip

Having to explicitly enter the ./ before your program’s name can actually be a good thing because it makes it less likely that you will accidentally run a different program with the same name in some other directory that is in your command path.

You can check to see if the current working directory is in your command path with the printenv command, as follows:

[jbc@andros jbc]$ printenv PATH /usr/local/bin:/bin:/usr/bin:/usr/sbin:. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Web Client Programming with Perl

Web Client Programming with Perl

Clinton Wong
Embedding Perl in HTML with Mason

Embedding Perl in HTML with Mason

Ken Williams, Dave Rolsky

Publisher Resources

ISBN: 1565926471Catalog PageErrata