You are not logged in.

#1 2015-06-15 06:42:31

MGu3l
Member
From: Medellín, Colombia
Registered: 2009-12-19
Posts: 109

[SOLVED] Adding custom bin folder to PATH

I'm sorry if what I'm looking for is not clear due to the Topic title, but it's the only phrase I can think of to explain what I need.

I'm reading this guide: http://linuxcommand.org/ and acording to it 'Most Linux distributions encourage a practice in which each user has a specific directory for the programs he/she personally uses. This directory is called bin and is a subdirectory of your home directory.'

So I went and created the bin folder in my home [where I have a "hello_world" script] and then added

PATH=$PATH:$HOME/bin

to my .bash_profile. Rebooted the system and... nothing happened, if I write the name of the script it just says it didn't find the order or something like it [it's in spanish].

How can I do this? basically what I want is to access those script kept in my /home/bin folder by its 'name'.

Thanks in advance!

Last edited by MGu3l (2015-06-15 07:30:21)


"Dream as if you'll live forever, live as if you'll die today" - James Dean

Offline

#2 2015-06-15 06:47:06

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [SOLVED] Adding custom bin folder to PATH

What is the output of `echo $PATH`?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2015-06-15 06:57:32

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,729

Re: [SOLVED] Adding custom bin folder to PATH

Wait, is the file in /home/bin or $HOME/bin?

Offline

#4 2015-06-15 07:01:16

MGu3l
Member
From: Medellín, Colombia
Registered: 2009-12-19
Posts: 109

Re: [SOLVED] Adding custom bin folder to PATH

jasonwryan, this is the output:

/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl

scimmia, the file is in /home/miguel/bin ... I tried adding this route as well but it won't work.


"Dream as if you'll live forever, live as if you'll die today" - James Dean

Offline

#5 2015-06-15 07:03:45

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [SOLVED] Adding custom bin folder to PATH

So, it seems .bash_profile is not being read: please paste the file and the permissions on it.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#6 2015-06-15 07:09:01

MGu3l
Member
From: Medellín, Colombia
Registered: 2009-12-19
Posts: 109

Re: [SOLVED] Adding custom bin folder to PATH

This are the permissions of the file:

-rw-r--r--   1 miguel users   129 jun 15 01:25 .bash_profile 

and this is the file itself:

#
# ~/.bash_profile
#

[[ -f ~/.bashrc ]] && . ~/.bashrc
[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx
PATH=$PATH:$HOME/bin

"Dream as if you'll live forever, live as if you'll die today" - James Dean

Offline

#7 2015-06-15 07:13:57

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 9,003
Website

Re: [SOLVED] Adding custom bin folder to PATH

MGu3l wrote:
#
# ~/.bash_profile
#

[[ -f ~/.bashrc ]] && . ~/.bashrc
[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx
PATH=$PATH:$HOME/bin

You are declaring $PATH *after* an `exec` line so that part of ~/.bash_profile is never parsed -- see exec()

Put the PATH line *before* the `exec startx` line.


Jin, Jîyan, Azadî

Offline

#8 2015-06-15 07:17:49

MGu3l
Member
From: Medellín, Colombia
Registered: 2009-12-19
Posts: 109

Re: [SOLVED] Adding custom bin folder to PATH

Head_on_a_stick, that did the trick and now it's working! Thank you so much!!

1 Question, will it work if the folder is hidden... instead of bin a folder called .bin in my home?

Last edited by MGu3l (2015-06-15 07:18:31)


"Dream as if you'll live forever, live as if you'll die today" - James Dean

Offline

#9 2015-06-15 07:21:01

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 9,003
Website

Re: [SOLVED] Adding custom bin folder to PATH

You're welcome smile

Please add "[SOLVED]" to the thread title for the benefit of others.

EDIT:

MGU3l wrote:

1 Question, will it work if the folder is hidden... instead of bin a folder called .bin in my home?

Only one way to find out...
tongue

Last edited by Head_on_a_Stick (2015-06-15 07:22:10)


Jin, Jîyan, Azadî

Offline

#10 2015-06-16 03:50:37

MGu3l
Member
From: Medellín, Colombia
Registered: 2009-12-19
Posts: 109

Re: [SOLVED] Adding custom bin folder to PATH

Head_on_a_Stick wrote:

Only one way to find out...
tongue

Jajajaj indeed... I just tried it and it works with a hidden folder.


"Dream as if you'll live forever, live as if you'll die today" - James Dean

Offline

Board footer

Powered by FluxBB