About adding PATH directories and maping in vim
I have 2 small problems, i have the sw11.0.
The 1st one, i want that my root directory be in the PATH, i add it, but i cant execute my C executable files directly. I added the following directories into the PATH, /~, /root. It is wrong? The 2nd is a vim remaping problem, i want to remap the f1 key to work like esc, i cant do it,i can remap esc to work calling help, but my f1 key dont work like esc. (i have the esc key a little far away and it force my hand to move out of the writing keys). THANKs. |
well your root directory should *NOT* be in your path. it's a really bad idea. if you wish to run your own compiled software, then you should put it in somewhere like /usr/local/bin/, or just run it with a relative or absolute path. now if you deicide to go against stnadard conventions then "/~" doesn't really make sense, it's invalid, but /root should be fine, so you've presumably got a syntax problem in the way you are defining it, or you are applying incorrectly somehow.
|
I put in the cmdln
export PATH=$PATH:root/java it work. But i want it to be executed in the boot. I put the same line in etc/rc.d/rc.local and it isnt working, what must put instead? acid_kewpie, a folder into the root directory is also unrecomended? why i mustnt put the root directory into the path? THANKS |
/root is where the system administrator puts all sorts of little bits of information and such, it's just not an organizd place to pur exectuables in the long term.
but if you must, edit your own personal /root/.bashrc file and add it there, e.g. "export PATH=$PATH:/root" |
I do it, but it dosnt work. The .bashrc file was empty, and i dont know if it already exist before i open it with: vim .bashrc
I put the ls command, and i cant see the file. Why i cant see it?, it is ocult?. |
a file that starts with a . is hidden. add the -a flag in ls and you'll see them. your bashrc really will always exist, unless you don't use bash or have a distro i've never seen before. you can also try ~/.profile too, which is largely shell agnostic.
|
.bashrc is not executed on login shells.
And bash_profile is not executed if bash is called by #!/bin/sh. So the best, IMO, would be to put this at end of /etc/profile: Code:
if [ "`id -u`" -eq 0 ]; then |
It is common to have a ~/bin/ personal bin directory to execute your own scripts and personal program files. Commands you install from a tarball probably should be installed in /usr/bin/ or /usr/local/bin/.
You can add the line "export PATH=$PATH:$HOME/bin" to your ~/.profile file. The .profile is run when you login, so you will need to run it manually "./.profile" if you haven't logged out. Also, the ~/.bashrc file is run every time a new subshell is run, so if you used ~/.bashrc instead, your added paths will be added twice. |
Quote:
|
Sorry, its not, see bash manual page:
http://www.die.net/doc/linux/man/man...tml#invocation I will add that if /etc/profile is executed then ~/.profile is not executed. This is what comes when you install debian, it looks very similar: Code:
root@debian# more /etc/profile |
yes, it calls ~/.bash_profile which as a standard for years and years has sourced ~/.bashrc if it's found. not sure why it really goes round the houses like that, but it's the way i've always known it.
|
Not that I would recommend this, but to map your F1 key in vi to be Esc you'll need to edit a file called .exrc in your home directory. Once in there enter the following.
Code:
:map! #1 ^[ You may still encounter a problem if you are using a terminal window in Gnome(I don't have KDE, so don't know). The Gnome terminal will capture your F1 and bring up help before it gets to vi. This can be overridden. On the Terminal screen menu go to Edit, then Keyboard Shortcuts. At the bottom of the list you'll see F1 listed as the shortcut key for help. Now, having said all that, it is not a good practice to use F1. F1 has been the standard help key on applications since function keys were first invented. For the $PATH question I would not put an entry in /etc/profile since that is system wide. It would be better to put it in /root/.bash_profile. That is always executed during login and typically where your environment is set. Also since SW-ANIKY is talking C executables and not java, /root/bin would be a more appropriate directory. A few people have said something similar to this already, but here is the entry I would use. Code:
export PATH=$PATH:$HOME/bin Some may disagree with me, but it is common practice to use .bashrc more for entering aliases and functions. I would put anything to do with the environment in .bash_profile. Bill |
Well disagree or not, don't care.
There is a manual page, people have to read it. You are right for alias and stuff: there shouldn't be any export command in bashrc files This is the most common error found in Linux, bashrc, profile and such things. Amazing. I agree with putting it in .bash_profile but it will only work if bash is invoked as bash, not as /bin/sh. Okay I'm fussy :) Edit : won't work with dash,csh,.. for example |
Thanks a lot, to all. Problem solved.
|
All times are GMT -5. The time now is 10:40 AM. |