- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- question from a beginner..
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2002 06:14 PM
12-29-2002 06:14 PM
question from a beginner..
i would like to know y sometimes in the command prompt i need to type #./xxx to run the program or file...but sometimes no need...how can i direct run the program without the ./ command??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2002 06:44 PM
12-29-2002 06:44 PM
Re: question from a beginner..
#./xxx means that xxx is in your current directory and the path is not set.
If the command you are typing
is in your path then no need to type ./xxx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2002 06:45 PM
12-29-2002 06:45 PM
Re: question from a beginner..
This is because your you dont have the current path set in your profile. If you set the PATH=$PATH:. in your profile and have execute permission for the file then you should be eable to run without ./..
Thanks
Rajeev
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2002 07:40 PM
12-29-2002 07:40 PM
Re: question from a beginner..
It is not always possible to have a path set to every conceivable thing, and it is not a good idea anyway.
The general way to have this done is in the users .profile file. What this does is add the directory paths to the defaults. See /etc/profile and /etc/PATH
e.g
PATH=$PATH:/usr/local/bin:/admin/scripts
export PATH
This can also be done from the command line.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2002 07:49 PM
12-29-2002 07:49 PM
Re: question from a beginner..
If the command you're running is searchable in the path variable (output of "echo $PATH") then you don't need the leading "./". Otherwise you have to run the command by specifying its exact path. By giving the leading "./" in front you're specifying its exact path (relative to your current directory).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-31-2002 04:49 AM
12-31-2002 04:49 AM
Re: question from a beginner..
set path=($path /xxx/xxx)
to put the directory in the path.
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-31-2002 08:10 AM
12-31-2002 08:10 AM
Re: question from a beginner..
echo $PATH
and you'll see something like:
/bin:/usr/sbin:/usr/ccs/bin:/usr/bin:
if "xxx" is not sitting in one of these directories it will never find "xxx" to run it.
The "./" means "search from this point."
You could modify your .profile to include your current location by default, simply by changing the PATH variable. For simplicity, put these two lines at the END of your .profile script:
PATH=$PATH:.
export PATH
WARNING! The system administrator account should never use the "dot" in their default path, as it would be a security risk. I personally take "." out of my login scripts to avoid this security flaw.
A better idea would be to organize all of your favorite tools into a specific directory, such as a "bin" directory placed inside your home directory:
cd (this sends you to your home directory)
mkdir bin
cp xxx ~/bin
vi .profile
PATH=$PATH:~/bin
export PATH
A final note: .profile is only read upon login OR when you specifically "source" it. After your edits, either logout and log back in, or use:
. .profile
to source the .profile all over again.
Spend a little time reading the man pages on sh and csh. The expressions of "., .., ~," and others are defined there. .profile is for sh, while .cshrc is for csh.
Good luck!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-31-2002 09:25 AM
12-31-2002 09:25 AM
Re: question from a beginner..
its Steve your Jewish Grandmother reminding you about security.
Don't ever put . into the root path. I don't understand or remember why, but its a huge security problem.
Happy New Year, though mine started a few months ago.
Steve
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2003 05:31 AM
01-02-2003 05:31 AM
Re: question from a beginner..
As an aside, I believe the reason for leaving out ./ from the PATH is for explicitness.
If (god forbid) you create a script in the local directory which also exists under the same name in another directory, and you run the command without the ./ prefix, the wrong script could be executed. By explicitly specifying current directory, you know exactly which script is running.
Share and Enjoy! Ian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2003 06:15 AM
01-02-2003 06:15 AM
Re: question from a beginner..
#echo $PATH
if the program that you are executing is in the PATH directories then you can execute the program from wherever you are in that system, otherwise cd to that directory (where the program exist) and ./