I am using cwm on OpenBSD 5.6 and have got my scripts in my ~/bin folder.
In my .zshrc the PATH is also exetended with
.zshrc:
export PATH=$PATH:~/bin
If I spawn the "exec program" dialog with M-? , my scripts do not appear in the dialog.
I cannot find any docs whether cwm sources any user-specific dot-rc files. Exporting the new PATH in .profile does not heled. Also in the .cwmrc there seems to be no config option to extend the search path.
My question:
How can I configure cwm to look also in my ~/bin to find executables there?
BTW my question does not concern the "command" config for the application menu.
I just tested it and it works fine for me, although I use ksh and not zsh but that shouldn't matter. A few things to look out for:
your script has to be executable
setting the PATH manually in an xterm while already running cwm won't work, because export only exports to children and is not visible by cwm
editing .zshrc may require you to logout (and in again) for changes to become visible (not 100% certain on this, since it depends on your setup), unless you're running it manually afterwards
Related
I'm new to WSL and Linux, but I'm trying to follow installation instructions for rhasspy (https://rhasspy.readthedocs.io/en/latest/installation/#windows-subsystem-for-linux-wsl). I have run the make install command successfully and the next step says I should copy rhasspy somewhere in my path but I can't quite figure out what copying to path means.
When installation is finished, copy rhasspy.sh somewhere in your PATH and rename it to rhasspy.
I added it to path but nothing changed so I was wondering if there is something I'm doing wrong. Right now when I run rhasspy on wsl it says rhasspy.sh: command not found. Any help would be really appreciated!
What it says is, put it in some place where the system will look for it when you type its name without full path in the shell.
There is an environment variable PATH that contains all those locations, separated by a :. (Check out echo $PATH.)
So, the author of these instructions leaves it up to you whether...
You want to copy the file to a location of your choice that is already in the PATH, such as /usr/local/bin or ~/bin.
Usually ~/bin is a good choice because it is per-user and doesn't pollute the system.
(Note that the directory ~/bin is added to the PATH by your .profile file only if it exists, so if you don't have this directory yet and create it now, you need to start a new login shell or run . ~/.profile1 before you can use it.)
- OR -
You want to create a new directory specifically for this application (say for example ~/opt/rhasspy) and append that directory to the PATH variable.
This can be done by adding the line export PATH=$PATH:~/opt/rhasspy to your ~/.profile file. Then, start a new login shell or reload the file using . ~/.profile1 for the changes to take effect.
If the directory in which this file is currently located is OK for you to keep permanently, then you can also just add that directory to the PATH instead of creating a new one.
Note: The PATH always contains directory paths in which the shell will look for executable files. It does not contain the actual file paths!
1: Yes, technically it is "cleaner" to log into a new shell or to run that one export statement manually instead of using . ~/.profile because the latter will apply things a second time that were already done before, so for example it can end up with the same directory in the PATH multiple times in the current session. In most cases that is fine though.
PATH is an environment variable. When you launch env, you see the list of known environment variables on your system.
In order to add something to your PATH variable, you need to take the variable, add the mentioned directory (preceeded by a semi-colon, most probably, as a separator) and store this again as the PATH variable. This can be done as follows (own example):
export PATH=$PATH:/home/this_user
the "PATH" it is referring to in linux is just inside the folder called /usr/bin. when you type a command into the terminal it looks for a program with that name inside the location. im not sure if this is the PATH you are looking for but hope it helps
I have recently installed a webframework play (http://www.playframework.com/) and want to have the play executable in the system path ie $PATH. But ubuntu already defines a command called play. How do I overwrite the system defined command with my framework binary path so that command play on commandline calls my framework rather than the old application.
Installation: I downloaded zipped file of the framework and upzipped in one of my personal folder which contains the docs and the executable.
Never alter the contents of installed packages. Such changes can provoke hard to find problems in the system and anyway, they will most likely be overwritten again in subsequent updates. There are other alternatives:
obviously you can chose another name for your executable
place the executable in another part of your $PATH if its a "personal installation", typically ~/bin is used for such approach. Remember that the order of entries in the $PATH variable is important, first come first serve.
use the traditional /usr/local/bin location for locally added "wild" installations, this way there is some form of clean separation between clean packages and wild installed files inside the system
store your software in some other location and prepend that to your personal or system wide $PATH variable
store your executable under another name and create an alias (see man alias for an explanation) for it which allows to call it by some name that "hides" the original command this way. For this the executable can be addressed with an absolute path, so it dies not have to be found inside the $PATH variable.
In my personal opinion options 2. and 5. and the best if it comes to "personal installations".
If you are sure you'll never use the original play command, you could just remove the binary. But in general, this isn't a good idea, since some system component you don't think of might need it, and the next update will probably restore it.
The best thing to do is to prepend the directory of your play command to the PATH, for example, using PATH=/opt/framework/bin:$PATH in your .profile (assuming your play command installs to /opt/framework/bin/play), or the script that starts your web server, or wherever you need your play command.
Remember that does not make your play command global. A common mistake is to add the path in their .profile file, then call the program from crontab - crontab scripts will not execute .profile or .bashrc.
At work I have gvim installed in C:/Program Files/vim but have no write permission on this folder. I would like vim to use my personal _vimrc and potentially some addins that would be in a bundle directory.
Problem is that vim choose the default _vimrc in C:/...
What can I do to fix my problem, I was thinking of a script but I can't manage in writing one that work... ?
EDIT: Off course I do not have admin rights
Your configuration belongs in %HOME% (or %USERPROFILE% if the former isn't set). You can always override that by setting the %MYVIMRC% environment variable (e.g. in the Windows Control Panel under Advanced System Settings) passing a different configuration script via -u path/to/vimrc. (Defining %VIMINIT% should work, too, but I didn't get it to work on Windows.) See :help startup for details.
The first place Vim looks for initializations (see :h .vimrc) is in your home directory. (If you're not sure where this is, you can use echo %HOMEPATH% from the command prompt to find out.)
Vim will use the _vimrc in your home directory if it exists, so you could just copy it there (%userprofile%_vimrc), or you could set the environment variable $VIM to the directory of your choice. You can set an environment variable on Windows by right-clicking on My Computer -> Properties -> Advanced System Settings. For more info see the vim docs.
I need help with TextMate. I installed it and want to compile Groovy within it (it seems convenient especially for trying things). I installed Groovy bundle but it doesn't work. It complains about:
Couldn't find /Applications/groovy-1.8.4/bin
If you have installed groovy, then you need to either update your PATH or set the
TM_GROOVY shell variable (e.g. in Preferences / Advanced)
Locations searched:
/Users/meir/Library/Application Support/TextMate/Pristine Copy/Bundles/Groovy.tmbundle/Suppor
/bin
/Applications/TextMate.app/Contents/SharedSupport/Support/bin/CocoaDialog.app/Contents/MacOS
/Users/meir/Library/Application Support/TextMate/Pristine Copy/Bundles/Groovy.tmbundle/Support
/bin
/Applications/TextMate.app/Contents/SharedSupport/Support/bin/CocoaDialog.app/Contents/MacOS
/usr/bin
/bin
/usr/sbin
/sbin
/Applications/groovy-1.8.4/bin
/Applications/grails-1.3.7/bin
/Applications/TextMate.app/Contents/SharedSupport/Support/bin
/Applications/TextMate.app/Contents/SharedSupport/Support/bin
I tried to do everything. I added path (/Applications/groovy-1.8.4/bin) to TM_GROOVY in settings, add to PATH variable in the same settings and I even added it to the system path but no help at all.
Please help.
To be clear you should click on TextMate > Preferences > Advanced > Shell Variables
Then add a Variable named 'TM_GROOVY' with the value being '/Applications/groovy-1.8.4/bin/groovy'
Not sure why but for my instance I actually have '.../groovy' specified explicitly.
The system I am using has gnuplot installed in /usr/bin. I don't have root, but I needed a newer version of gnuplot, so I installed it to $HOME/usr/bin.
I added $HOME/usr/bin to my path, but it still executes the one in /usr/bin if I just use the gnuplot command. I'd rather not have to specify $HOME/usr/bin/gnuplot every time I have to use it.
How do I tell Linux to use the one in my home directory, and not the one in /usr/bin?
Executables are found in PATH order. You need to prepend ${HOME}/usr/bin to your path, like so:
export PATH="${HOME}/usr/bin:$PATH"
Executables are found in PATH order. Your PATH apparently is set up such that /usr/bin precedes ~/usr/bin/.
Besides modifying the PATH as has been explained, you can also use aliases like this (in BASH)
alias gn=$HOME/usr/bin/gnuplot
then you just run it with
gn
What Bombe says is ok. I would add that you should declare your user specific PATH entries inside your user's bashrc ($HOME/.bashrc), so your PATH settings only apply to your user.