LinuxQuestions.org
Help answer threads with 0 replies.
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 11-29-2011, 11:24 AM   #1
afiqrahim
LQ Newbie
 
Registered: Aug 2011
Posts: 6

Rep: Reputation: Disabled
Unhappy vi editor


$ store
Which file do you want to store: demo
Do you want to delete file demo in its current location? [y/n]: y
You can always retrieve the file with 'getback' later.
Good Bye
$

How do I write a program that starts with entering the program's name instead of having to enter ./(DotSlash) at the beginning.
The example of the output of the program is as stated above. A little help please :-)
 
Old 11-29-2011, 11:29 AM   #2
kbscores
Member
 
Registered: Oct 2011
Location: USA
Distribution: Red Hat
Posts: 259
Blog Entries: 9

Rep: Reputation: 32
Add it to a bin directory or add script's location to path.
 
Old 11-29-2011, 11:32 AM   #3
afiqrahim
LQ Newbie
 
Registered: Aug 2011
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by kbscores View Post
Add it to a bin directory or add script's location to path.
example?
 
Old 11-29-2011, 11:33 AM   #4
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
Quote:
Originally Posted by afiqrahim View Post
How do I write a program that starts with entering the program's name instead of having to enter ./(DotSlash) at the beginning.
The example of the output of the program is as stated above. A little help please :-)
The output has nothing to do with how you start the program. In a typical Unix(-like) environment you launch an executable (in a shell) by giving (full or relative to current working directory) path to it, along with the executable filename. Certain directories are searched automatically, for example /bin, /usr/bin, and so on. This means that even if you do not give full or relative path to the executable, i.e., you simply type the executable filename, certain directories (usually listed in an environment variable $PATH) are looked into, and if an executable of the name you gave is found in one of them, it is executed from there. If it exists in multiple directories that are searched, typically it is executed from the first directory where it is found.

To get your program to run "without giving path", you either put it into a directory that is automatically searched (see directories listed in $PATH), or add the directory, where the executable is, to the list yourself. Note: while it may be possible to have the system search for the current working directory first, meaning that you could execute any file within the current directory without typing the dot-slash, it might not be wise; this would make it a lot easier to accidentally run a program, which you usually do not want to do.
 
1 members found this post helpful.
Old 11-29-2011, 11:35 AM   #5
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
If you're using Bash and your program is in /home/user/bin, add the following line to your .bashrc:

export PATH=$PATH:/home/user/bin

This appends the directory "/home/user/bin" to the list in the variable $PATH.

Also, your question has nothing to do with vi. In future, please try to use titles that are descriptive of your question/problem.
 
  


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
linux distro / photo editor / music editor of choice ?? expatcanuck Linux - Newbie 1 05-04-2009 05:24 PM
LXer: Open Movie Editor: Linux Video Editor with Plot Twists LXer Syndicated Linux News 0 10-27-2008 09:50 PM
How do I use an editor? staph Linux - Newbie 12 02-02-2007 10:12 AM
VI Editor rakriege Linux - General 2 02-04-2004 07:57 PM
c best editor alaios Programming 24 12-08-2003 06:50 AM

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

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