You are not logged in.

#1 2009-10-15 18:40:05

anonymous_user
Member
Registered: 2009-08-28
Posts: 3,059

running programs from ~/bin [Solved]

With Ubuntu I could copy executables into my ~/bin folder and then just run them by typing the name (in terminal or run box).

How can I do this in Arch?

Last edited by anonymous_user (2009-10-16 21:14:44)

Offline

#2 2009-10-15 18:44:24

rson451
Member
From: Annapolis, MD USA
Registered: 2007-04-15
Posts: 1,233
Website

Re: running programs from ~/bin [Solved]

By adding ~/bin/ to your $PATH.


archlinux - please read this and this — twice — then ask questions.
--
http://rsontech.net | http://github.com/rson

Offline

#3 2009-10-15 19:13:13

Lich
Member
Registered: 2009-09-13
Posts: 437

Re: running programs from ~/bin [Solved]

to be "compliant", add this to your ~/.bashrc

export PATH='$PATH:$HOME/bin'

Last edited by Lich (2009-10-15 19:14:02)


Archlinux | ratpoison + evilwm | urxvtc | tmux

Offline

#4 2009-10-15 19:33:10

anonymous_user
Member
Registered: 2009-08-28
Posts: 3,059

Re: running programs from ~/bin [Solved]

Ok I did that but then I can't launch any programs from my terminal. It says command not found.

Once I remove that line from my .bashrc, it works fine again.

Last edited by anonymous_user (2009-10-15 19:33:26)

Offline

#5 2009-10-15 19:39:02

Spider.007
Member
Registered: 2004-06-20
Posts: 1,175

Re: running programs from ~/bin [Solved]

Show us the output of

echo $PATH

when it is added. There must be something wrong for it to find less commands smile

Offline

#6 2009-10-15 19:39:34

Lich
Member
Registered: 2009-09-13
Posts: 437

Re: running programs from ~/bin [Solved]

you need to source your bashrc after you add that line

source ~/.bashrc

Archlinux | ratpoison + evilwm | urxvtc | tmux

Offline

#7 2009-10-15 19:40:54

Peasantoid
Member
Registered: 2009-04-26
Posts: 928
Website

Re: running programs from ~/bin [Solved]

Lich wrote:

to be "compliant", add this to your ~/.bashrc

export PATH='$PATH:$HOME/bin'

That doesn't work. You enclosed the string in single quotes. It should have been this:

export PATH="$PATH:$HOME/bin"

Double quotes enable variable interpolation.

Last edited by Peasantoid (2009-10-15 19:43:01)

Offline

#8 2009-10-15 19:43:17

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: running programs from ~/bin [Solved]

Lich wrote:

to be "compliant", add this to your ~/.bashrc

export PATH='$PATH:$HOME/bin'

That doesn't work because of the single quotes (bash doesn't interpolate variables inside single quotes). Use double quotes:

export PATH="$PATH:$HOME/bin"

My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#9 2009-10-15 19:46:32

anonymous_user
Member
Registered: 2009-08-28
Posts: 3,059

Re: running programs from ~/bin [Solved]

I used the double quotes and it works for the terminal. Thanks.

Now is there a way so I can also run the programs from xfrun4?

Offline

#10 2009-10-15 19:49:32

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: running programs from ~/bin [Solved]

@Peasantoid
Hehe, nearly identical replies. I didn't want to edit my post with the traditional "bah, beat me to it" remark as I want to leave it completely intact.

I found this amusing.



*note to self*
post first, double-check and maybe edit later


anonymous_user wrote:

I used the double quotes and it works for the terminal. Thanks.

Now is there a way so I can also run the programs from xfrun4?

Log out and log back in so that your login terminal sources your bashrc.

Last edited by Xyne (2009-10-15 19:50:40)


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#11 2009-10-15 19:54:36

anonymous_user
Member
Registered: 2009-08-28
Posts: 3,059

Re: running programs from ~/bin [Solved]

Didn't work. I can launch the program from terminal but not xfrun4.

Offline

#12 2009-10-15 20:02:38

Peasantoid
Member
Registered: 2009-04-26
Posts: 928
Website

Re: running programs from ~/bin [Solved]

Xyne wrote:

@Peasantoid
Hehe, nearly identical replies. I didn't want to edit my post with the traditional "bah, beat me to it" remark as I want to leave it completely intact.

I found this amusing.

Damn man, that's weird!

Great minds think alike... tongue

@anonymous_user: Here's a fairly simple (but questionably elegant) workaround for xfrun4. Rename the real xfrun4 to something like _xfrun4, then create this script in its place:

#!/bin/bash
source ~/.bashrc
_xfrun4 $@

Remember to `chmod +x` the script.

Last edited by Peasantoid (2009-10-15 20:03:53)

Offline

#13 2009-10-15 20:36:14

anonymous_user
Member
Registered: 2009-08-28
Posts: 3,059

Re: running programs from ~/bin [Solved]

That still doesn't work. Im thinking it may just be easier to copy my scripts to /usr/bin or something.

Last edited by anonymous_user (2009-10-15 20:37:35)

Offline

#14 2009-10-15 20:44:10

Peasantoid
Member
Registered: 2009-04-26
Posts: 928
Website

Re: running programs from ~/bin [Solved]

What do you mean 'it doesn't work'? Is there an error message? What?

(If you're sticking that in ~/.bin, it's not going to work, since that's what you're trying to enable in the first place tongue)

Last edited by Peasantoid (2009-10-15 20:44:38)

Offline

#15 2009-10-15 21:10:13

quarkup
Member
From: Portugal
Registered: 2008-09-07
Posts: 497
Website

Re: running programs from ~/bin [Solved]

have you created that folder first?


mkdir ~/bin

then just add the line to .bashrc, or edit the PATH variable in /etc/profile


If people do not believe that mathematics is simple, it is only because they do not realize how complicated life is.
Simplicity is the ultimate sophistication.

Offline

#16 2009-10-16 00:03:20

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: running programs from ~/bin [Solved]

Lich wrote:

to be "compliant", add this to your ~/.bashrc

export PATH='$PATH:$HOME/bin'

This might work (using double quotes or even none at all). But I prefer it the other way around:

export PATH=$HOME/bin:$PATH

Bash will now search the ~/bin directory first. This is preferable, since I often put wrapper scripts around applications and keep them under the original name in my ~/bin. So my wrapper script will always be called instead of the original application in e.g. /usr/bin.

Moreover I did put this PATH extension into my $HOME/.bash_profile:

. $HOME/.bashrc

# Make sure the users bin directory will be searched in first place.
if [ -d $HOME/bin ]
then
    export PATH=$HOME/bin:$PATH
fi

That way the path will be changed on login only and not everytime an interactive bash is started.

Last edited by bernarcher (2009-10-16 00:08:20)


To know or not to know ...
... the questions remain forever.

Offline

#17 2009-10-16 01:04:24

anonymous_user
Member
Registered: 2009-08-28
Posts: 3,059

Re: running programs from ~/bin [Solved]

bernarcher wrote:
Lich wrote:

to be "compliant", add this to your ~/.bashrc

export PATH='$PATH:$HOME/bin'

This might work (using double quotes or even none at all). But I prefer it the other way around:

export PATH=$HOME/bin:$PATH

Bash will now search the ~/bin directory first. This is preferable, since I often put wrapper scripts around applications and keep them under the original name in my ~/bin. So my wrapper script will always be called instead of the original application in e.g. /usr/bin.

Moreover I did put this PATH extension into my $HOME/.bash_profile:

. $HOME/.bashrc

# Make sure the users bin directory will be searched in first place.
if [ -d $HOME/bin ]
then
    export PATH=$HOME/bin:$PATH
fi

That way the path will be changed on login only and not everytime an interactive bash is started.

Didn't work

quarkup wrote:

have you created that folder first?

Yes it was already created.

Peasantoid wrote:

What do you mean 'it doesn't work'? Is there an error message? What?

See:

d6ae_2009_10_15_1255654906_1280x1024_scrot.png

Offline

#18 2009-10-16 01:15:18

rson451
Member
From: Annapolis, MD USA
Registered: 2007-04-15
Posts: 1,233
Website

Re: running programs from ~/bin [Solved]

Peasantoid wrote:

Remember to `chmod +x` the script.


archlinux - please read this and this — twice — then ask questions.
--
http://rsontech.net | http://github.com/rson

Offline

#19 2009-10-16 01:17:25

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: running programs from ~/bin [Solved]

Hmm! Stupid question: Is your conky-start executable at all? wink
(The Properties window does show "Read & Write" only.)

Also you need to re-login to make the .bash_profile changes current.

Last edited by bernarcher (2009-10-16 01:19:22)


To know or not to know ...
... the questions remain forever.

Offline

#20 2009-10-16 01:23:55

anonymous_user
Member
Registered: 2009-08-28
Posts: 3,059

Re: running programs from ~/bin [Solved]

Its already executable:

[kevin]~/bin$ chmod +x -v conky-start
mode of `conky-start' retained as 0755 (rwxr-xr-x)

Offline

#21 2009-10-16 01:28:31

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: running programs from ~/bin [Solved]

What happens if you try to explicitely run it:

$ ~/bin/conky-start

Also, what does "echo $PATH" say?

Last edited by bernarcher (2009-10-16 01:29:45)


To know or not to know ...
... the questions remain forever.

Offline

#22 2009-10-16 01:34:17

anonymous_user
Member
Registered: 2009-08-28
Posts: 3,059

Re: running programs from ~/bin [Solved]

If I run it explicitly, I get the same error.

[kevin]~$ echo $PATH
/home/kevin/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/bin/perlbin/site:/usr/bin/perlbin/vendor:/usr/bin/perlbin/core

Last edited by anonymous_user (2009-10-16 01:35:10)

Offline

#23 2009-10-16 01:42:55

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: running programs from ~/bin [Solved]

Weird! Maybe your conky-start is corrupted.

But yet another try. Does it work when you run it from the ~/bin directory?

cd bin
./conky-start

(Also try without the "./)


To know or not to know ...
... the questions remain forever.

Offline

#24 2009-10-16 01:47:47

anonymous_user
Member
Registered: 2009-08-28
Posts: 3,059

Re: running programs from ~/bin [Solved]

Just to clarify:

conky-start works fine from the terminal, but not from xfrun4.

Offline

#25 2009-10-16 02:16:52

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: running programs from ~/bin [Solved]

Ok, I googled a bit for

xfrun4 "failed to execute child process"

It appears this is an old problem with xfrun4 which does not properly use the PATH settings. See for instance this bug report.

Sorry, I have no idea how to proceed, then. sad

Last edited by bernarcher (2009-10-16 02:18:25)


To know or not to know ...
... the questions remain forever.

Offline

Board footer

Powered by FluxBB