hi I have a strange problem ...
On my computer "maven" (an IDE for developent in java language) is installed in the directory: "/ opt / netbeans / java / maven / bin / mvn".
And I can run it (maven) by giving its full path from the command line.
I wanted to modify the PATH variable to use the simple name of the program "mvn".
I did it and actually I get this output for the command : ------- angelo_dev @ pluto: echo $ PATH: / Usr / share / Modules / bin: / usr / local / bin: / usr / local / sbin: / usr / bin: / usr / sbin: / opt / netbeans / java / maven / bin / mvn. ------- However when I use of the mvn command (without specifying its complete value) it does not work, I get this output; ------- angelo_dev @ pluto: ~ $ mvn bash: mvn: command not found ... Install package 'maven' to provide command 'mvn'? [N / y] --------
I cannot understand...
Can anyone help me understand this problem
Thanks Angelo.
On 3/24/20 8:11 AM, Angelo Moreschini wrote:
hi I have a strange problem ...
On my computer "maven" (an IDE for developent in java language) is installed in the directory: "/ opt / netbeans / java / maven / bin / mvn".
And I can run it (maven) by giving its full path from the command line.
I wanted to modify the PATH variable to use the simple name of the program "mvn".
I did it and actually I get this output for the command :
angelo_dev @ pluto: echo $ PATH: / Usr / share / Modules / bin: / usr / local / bin: / usr / local / sbin: / usr / bin: / usr / sbin: / opt / netbeans / java / maven / bin / mvn.
Salve Angelo,
There is an error in the maven portion of the path: it ends in mvn. It is supposed to end in bin.
Mike Wright
OK,
you are right :-)
thank you
On Tue, Mar 24, 2020 at 5:29 PM Mike Wright nobody@nospam.hostisimo.com wrote:
On 3/24/20 8:11 AM, Angelo Moreschini wrote:
hi I have a strange problem ...
On my computer "maven" (an IDE for developent in java language) is installed in the directory: "/ opt / netbeans / java / maven / bin /
mvn".
And I can run it (maven) by giving its full path from the command line.
I wanted to modify the PATH variable to use the simple name of the
program
"mvn".
I did it and actually I get this output for the command :
angelo_dev @ pluto: echo $ PATH: / Usr / share / Modules / bin: / usr / local / bin: / usr / local /
sbin: /
usr / bin: / usr / sbin: / opt / netbeans / java / maven / bin / mvn.
Salve Angelo,
There is an error in the maven portion of the path: it ends in mvn. It is supposed to end in bin.
Mike Wright _______________________________________________ users mailing list -- users@lists.fedoraproject.org To unsubscribe send an email to users-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org
Still thank you, ... it works now.
But I have still another (little) problem:
To change the path, I wrote in the directory /etc/profile.d, a shell script with this content: --- PATH=$PATH:/opt/netbeans/java/maven/bin export PATH -----
I don't understand because the output of the command echo $PATH is now; -------- /usr/share/Modules/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin: */opt/netbeans/java/maven/bin*:/*opt/netbeans/java/maven/bin* ------- the PATH of "maven" is added two times...
what is the reason ???
On Tue, Mar 24, 2020 at 6:12 PM Angelo Moreschini mrangelo.fedora@gmail.com wrote:
OK,
you are right :-)
thank you
On Tue, Mar 24, 2020 at 5:29 PM Mike Wright nobody@nospam.hostisimo.com wrote:
On 3/24/20 8:11 AM, Angelo Moreschini wrote:
hi I have a strange problem ...
On my computer "maven" (an IDE for developent in java language) is installed in the directory: "/ opt / netbeans / java / maven / bin /
mvn".
And I can run it (maven) by giving its full path from the command line.
I wanted to modify the PATH variable to use the simple name of the
program
"mvn".
I did it and actually I get this output for the command :
angelo_dev @ pluto: echo $ PATH: / Usr / share / Modules / bin: / usr / local / bin: / usr / local /
sbin: /
usr / bin: / usr / sbin: / opt / netbeans / java / maven / bin / mvn.
Salve Angelo,
There is an error in the maven portion of the path: it ends in mvn. It is supposed to end in bin.
Mike Wright _______________________________________________ users mailing list -- users@lists.fedoraproject.org To unsubscribe send an email to users-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org
so ... what is the correct content of the script in order to have only one instance of the new PATH to add ??
On Tue, Mar 24, 2020 at 6:45 PM Patrick Dupre pdupre@gmx.com wrote:
This is correct.
You add a new path to the old path. Then it duplicates the path
=========================================================================== Patrick DUPRÉ | | email: pdupre@gmx.com Laboratoire interdisciplinaire Carnot de Bourgogne 9 Avenue Alain Savary, BP 47870, 21078 DIJON Cedex FRANCE Tel: +33 (0)380395988 ===========================================================================
*Sent:* Tuesday, March 24, 2020 at 5:37 PM *From:* "Angelo Moreschini" mrangelo.fedora@gmail.com *To:* "Community support for Fedora users" users@lists.fedoraproject.org *Subject:* Re: problem setting the PATH variable. Still thank you, ... it works now.
But I have still another (little) problem:
To change the path, I wrote in the directory /etc/profile.d, a shell script with this content:
PATH=$PATH:/opt/netbeans/java/maven/bin export PATH
I don't understand because the output of the command echo $PATH is now;
/usr/share/Modules/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:
*/opt/netbeans/java/maven/bin*:/*opt/netbeans/java/maven/bin*
the PATH of "maven" is added two times...
what is the reason ???
On Tue, Mar 24, 2020 at 6:12 PM Angelo Moreschini < mrangelo.fedora@gmail.com> wrote:
OK,
you are right :-)
thank you
On Tue, Mar 24, 2020 at 5:29 PM Mike Wright nobody@nospam.hostisimo.com wrote:
On 3/24/20 8:11 AM, Angelo Moreschini wrote:
hi I have a strange problem ...
On my computer "maven" (an IDE for developent in java language) is installed in the directory: "/ opt / netbeans / java / maven / bin /
mvn".
And I can run it (maven) by giving its full path from the command
line.
I wanted to modify the PATH variable to use the simple name of the
program
"mvn".
I did it and actually I get this output for the command :
angelo_dev @ pluto: echo $ PATH: / Usr / share / Modules / bin: / usr / local / bin: / usr / local /
sbin: /
usr / bin: / usr / sbin: / opt / netbeans / java / maven / bin / mvn.
Salve Angelo,
There is an error in the maven portion of the path: it ends in mvn. It is supposed to end in bin.
Mike Wright _______________________________________________ users mailing list -- users@lists.fedoraproject.org To unsubscribe send an email to users-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org
_______________________________________________ users mailing list --
users@lists.fedoraproject.org To unsubscribe send an email to users-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org _______________________________________________ users mailing list -- users@lists.fedoraproject.org To unsubscribe send an email to users-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org
On Tue, 24 Mar 2020 at 14:42, Angelo Moreschini mrangelo.fedora@gmail.com wrote:
so ... what is the correct content of the script in order to have only one instance of the new PATH to add ??
Look in /etc/profile for a function called pathmunge. This checks to see if the new PATH component is already in the PATH and can be used with scripts in /etc/profile.d. The function is deleted after the scripts have been sourced.
On Tue, Mar 24, 2020 at 6:45 PM Patrick Dupre pdupre@gmx.com wrote:
This is correct.
You add a new path to the old path. Then it duplicates the path
=========================================================================== Patrick DUPRÉ | | email: pdupre@gmx.com Laboratoire interdisciplinaire Carnot de Bourgogne 9 Avenue Alain Savary, BP 47870, 21078 DIJON Cedex FRANCE Tel: +33 (0)380395988
===========================================================================
*Sent:* Tuesday, March 24, 2020 at 5:37 PM *From:* "Angelo Moreschini" mrangelo.fedora@gmail.com *To:* "Community support for Fedora users" <users@lists.fedoraproject.org
*Subject:* Re: problem setting the PATH variable. Still thank you, ... it works now.
But I have still another (little) problem:
To change the path, I wrote in the directory /etc/profile.d, a shell script with this content:
PATH=$PATH:/opt/netbeans/java/maven/bin export PATH
I don't understand because the output of the command echo $PATH is now;
/usr/share/Modules/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:
*/opt/netbeans/java/maven/bin*:/*opt/netbeans/java/maven/bin*
the PATH of "maven" is added two times...
what is the reason ???
On Tue, Mar 24, 2020 at 6:12 PM Angelo Moreschini < mrangelo.fedora@gmail.com> wrote:
OK,
you are right :-)
thank you
On Tue, Mar 24, 2020 at 5:29 PM Mike Wright nobody@nospam.hostisimo.com wrote:
On 3/24/20 8:11 AM, Angelo Moreschini wrote:
hi I have a strange problem ...
On my computer "maven" (an IDE for developent in java language) is installed in the directory: "/ opt / netbeans / java / maven / bin /
mvn".
And I can run it (maven) by giving its full path from the command
line.
I wanted to modify the PATH variable to use the simple name of the
program
"mvn".
I did it and actually I get this output for the command :
angelo_dev @ pluto: echo $ PATH: / Usr / share / Modules / bin: / usr / local / bin: / usr / local /
sbin: /
usr / bin: / usr / sbin: / opt / netbeans / java / maven / bin / mvn.
Salve Angelo,
There is an error in the maven portion of the path: it ends in mvn. It is supposed to end in bin.
Mike Wright _______________________________________________ users mailing list -- users@lists.fedoraproject.org To unsubscribe send an email to users-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org
_______________________________________________ users mailing list --
users@lists.fedoraproject.org To unsubscribe send an email to users-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org _______________________________________________ users mailing list -- users@lists.fedoraproject.org To unsubscribe send an email to users-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org
users mailing list -- users@lists.fedoraproject.org To unsubscribe send an email to users-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org
On 24Mar2020 17:43, Patrick Dupre pdupre@gmx.com wrote:
This is correct. You add a new path to the old path. Then it duplicates the path
No, his script is correct (to do it for all users).
I expect he is running the PATH= command twice - once from /etc/profile.d, and maybe once in his personal .profile or .bash_profile or .bashrc.
Cameron Simpson cs@cskk.id.au
On Tue, 24 Mar 2020 at 19:23, Cameron Simpson cs@cskk.id.au wrote:
On 24Mar2020 17:43, Patrick Dupre pdupre@gmx.com wrote:
This is correct. You add a new path to the old path. Then it duplicates the path
No, his script is correct (to do it for all users).
I expect he is running the PATH= command twice - once from /etc/profile.d, and maybe once in his personal .profile or .bash_profile or .bashrc.
Some applications (IDE?) appear to source /etc/profile when starting, which is why we have the pathmunge function. I think this is done so you have the same PATH whether the app is run by clicking on a menu or by starting it from a terminal.
Cameron Simpson <cs@cskk.id.au
I couldn't understand the reason for the double registration of the path : (surly the script was executed twice). I write (for the benefit of others) the solution I found: (I modified the script with a condition).
--------- newpath="/opt/netbeans/java/maven/bin" if [[ "$PATH" != *"$newpath"* ]]; then PATH=$PATH:/opt/netbeans/java/maven/bin export PATH fi ---------
On Wed, Mar 25, 2020 at 1:16 AM George N. White III gnwiii@gmail.com wrote:
On Tue, 24 Mar 2020 at 19:23, Cameron Simpson cs@cskk.id.au wrote:
On 24Mar2020 17:43, Patrick Dupre pdupre@gmx.com wrote:
This is correct. You add a new path to the old path. Then it duplicates the path
No, his script is correct (to do it for all users).
I expect he is running the PATH= command twice - once from /etc/profile.d, and maybe once in his personal .profile or .bash_profile or .bashrc.
Some applications (IDE?) appear to source /etc/profile when starting, which is why we have the pathmunge function. I think this is done so you have the same PATH whether the app is run by clicking on a menu or by starting it from a terminal.
Cameron Simpson <cs@cskk.id.au
-- George N. White III
users mailing list -- users@lists.fedoraproject.org To unsubscribe send an email to users-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org
On 25Mar2020 05:31, Angelo Moreschini mrangelo.fedora@gmail.com wrote:
I couldn't understand the reason for the double registration of the path : (surly the script was executed twice).
Or the same incantation is elsewhere in your setup, thus doing it twice. Eg .profile or something.
I write (for the benefit of others) the solution I found: (I modified the script with a condition).
newpath="/opt/netbeans/java/maven/bin"
No quotes needed here.
if [[ "$PATH" != *"$newpath"* ]]; then
This is a little fuzzy. It is conceivable (though in this case unlikely) that your $PATH contains something like:
/something/opt/netbeans/java/maven/bin
or:
/opt/netbeans/java/maven/bin-other-thing
and your match would mistakenly thing the path:
/opt/netbeans/java/maven/bin
was present. Personally I am old school and do this with a case statement (though the same can be applied with [[....]]):
case ":$PATH:" in *":$newpath:"*) # already present ;; *) PATH=$PATH:$newpath export PATH ;; esac
The important thing here isn't case vs [[....]], it is the ":" bracketing of $PATH and $newpath to avoid accidentally matching a longer string which just happens to contain $newpath.
PATH=$PATH:/opt/netbeans/java/maven/bin
Use $newpath here, avoids writing the maven path twice:
PATH=$PATH:$newpath
export PATH fi
But the incantation is being run twice. How that is happening seems worth investigating when you're idle and bored.
Elsewhere in the thread someone mentioned some presupplied shell function for adding to $PATH which contains essentially the logic in your if-statement.
Cheers, Cameron Simpson cs@cskk.id.au
thanks for the tips .. I don't have experience writing bash scripts, (writing them is torture because I'm always wrong ...;-) ), .....I only copied the check of substrings from an example.
You was very kind with your suggestions , and I will bring the improvements you suggested me :-).
Regarding the use of the condition, <if>, in my opinion this is an excellent solution (because it is practical and really *efficient*) so no matter about how the setup works, Thanks again .
Angelo
On Wed, Mar 25, 2020 at 6:46 AM Cameron Simpson cs@cskk.id.au wrote:
On 25Mar2020 05:31, Angelo Moreschini mrangelo.fedora@gmail.com wrote:
I couldn't understand the reason for the double registration of the path : (surly the script was executed twice).
Or the same incantation is elsewhere in your setup, thus doing it twice. Eg .profile or something.
I write (for the benefit of others) the solution I found: (I modified the script with a condition).
newpath="/opt/netbeans/java/maven/bin"
No quotes needed here.
if [[ "$PATH" != *"$newpath"* ]]; then
This is a little fuzzy. It is conceivable (though in this case unlikely) that your $PATH contains something like:
/something/opt/netbeans/java/maven/bin
or:
/opt/netbeans/java/maven/bin-other-thing
and your match would mistakenly thing the path:
/opt/netbeans/java/maven/bin
was present. Personally I am old school and do this with a case statement (though the same can be applied with [[....]]):
case ":$PATH:" in *":$newpath:"*) # already present ;; *) PATH=$PATH:$newpath export PATH ;; esac
The important thing here isn't case vs [[....]], it is the ":" bracketing of $PATH and $newpath to avoid accidentally matching a longer string which just happens to contain $newpath.
PATH=$PATH:/opt/netbeans/java/maven/bin
Use $newpath here, avoids writing the maven path twice:
PATH=$PATH:$newpath
export PATH fi
But the incantation is being run twice. How that is happening seems worth investigating when you're idle and bored.
Elsewhere in the thread someone mentioned some presupplied shell function for adding to $PATH which contains essentially the logic in your if-statement.
Cheers, Cameron Simpson cs@cskk.id.au _______________________________________________ users mailing list -- users@lists.fedoraproject.org To unsubscribe send an email to users-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org
On 03/25/2020 02:10 AM, Angelo Moreschini wrote:
thanks for the tips .. I don't have experience writing bash scripts, (writing them is torture because I'm always wrong ...;-) ),
This might be of some help: http://tldp.org/LDP/abs/html/