On Wed, Nov 25, 2015 at 11:21:04PM +0100, Jiri Navratil wrote:
> Hello,
> 
> I'm using ksh and I have in ~/.kshrc
> 
> LOCATE_PATH=$HOME/.locate.database:/var/db/locate.database
> 
> (I'm not using export there to be consistent with /etc/ksh.kshrc)
> 
> in ~/.profile I have
> 
> export ENV=$HOME/.kshrc
> 
> ksh is showing this variable in set command, but I have to export this 
> variable manually to have it working
> 
> $ set | grep LOCATE                                                         
> LOCATE_PATH=/home/navratil/.locate.database:/var/db/locate.database
> $ locate evMp6ma3xnk4IOJq6SGU
> $ export LOCATE_PATH=$HOME/.locate.database:/var/db/locate.database
> $ locate evMp6ma3xnk4IOJq6SGU                                      
> /home/navratil/evMp6ma3xnk4IOJq6SGU
> 
> Please advice, what I have to adjust to have locate working with
> LOCATE_PATH without manually exporting it.

Without exporting the variable into the environment of the locate
command, it will no work.  You can do this in various ways.

1) export LOCATE_PATH
   ... in $ENV, but you, for some reason, do not want to do this.

2) set -o allexport
   ... at the top of $ENV.  Sets the shell option 'allexport' which
   means all new variables are automatically exported.  This may have
   unwanted side-effects.

3) env LOCATE_PATH="$LOCATE_PATH" locate
   ... each time you execute locate.

4) Write a short shell script that does something equivalent of 3)

5) Do not use locate.

-- 
:: Andreas Kusalananda Kähäri
:: Bioinformatics Developer
:: Uppsala, Sweden
::----------------------------------------------------------------------

Reply via email to