help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to make GUI applications inherit PATH


From: Greg Wooledge
Subject: Re: How to make GUI applications inherit PATH
Date: Tue, 9 Mar 2021 09:04:33 -0500

On Tue, Mar 09, 2021 at 09:37:38AM -0300, Fernando Basso wrote:
> I am creating a launcher in Xfce4 to run `gvim -f'. When I click the
> launcher, gvim opens and complains it cannot find nodejs, which I
> install through nvm (node version manager), which is added to `PATH' in
> `~/.bashrc'.
> 
> I tried creating a wrapper script, something like this:
> 
>       #!/usr/bin/env -S bash --login
>       gvim -f "$@"

Why, why, why, why.

#!/bin/bash
if ! command -v nodejs >/dev/null; then
  source ~/.bashrc
fi
exec gvim -f "$@"


An even better solution would be to set PATH=$PATH:whatever directly
in the wrapper script.  Relying on an end user's dot files for a script
to work is a terrible idea, even if the end user is you.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]