Add to Debian search path for programmes?

The place to post if you need help or advice

Moderators: ChrisThornett, LXF moderators

Add to Debian search path for programmes?

Postby SiriusHardware » Tue Oct 30, 2012 10:45 pm

I'm trying to install, run and use a cross-assembler. Debian Squeeze.

This program is written in Python (V2) and is apparently configured as a Python 'Package', with a small launcher outside of a main package directory containing all the Python modules which make up the program.

This linux PC has Python V2.6 installed, as it came on the distro.

The installation instructions for Linux say to create home/you/bin (where 'you' is my username, presumably) - it did not already exist, so I've done that and now have that directory structure in place.

Next step is to copy the launcher file XASM to home/you/bin, along with the directory containing all the support files for XASM

The notes on programme installation say that on some distros such as Ubuntu the mere act of creating home/you/bin will cause an appropriate section to be added to the 'PATH' automatically, but otherwise to do it manually.

I've tried my best to understand how to do this, but at the moment the only way I can run the programme is to go to home/you/bin where I can actually see the XASM file and type (for example)

Code: Select all
python XASM 6502.asm


That works.

As far as I can see, the 'profile' file in /etc profile does have a bit pointing to my usr/bin directory and should be looking there, but when I type

Code: Select all
python XASM <enter>


...from any other place in the directory tree, BASH can not find XASM. If it did find it, I would expect to be asked for the .asm file name. Instead, it BASH just complains that it can not find XASM at all.
.
Here's what I hope is the relevant section from etc/profile
Code: Select all
if [ "`id -u`" -eq 0 ]; then
  PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
  PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
fi
export PATH


What am I missing here?
Last edited by SiriusHardware on Tue Oct 30, 2012 11:22 pm, edited 1 time in total.
SiriusHardware
 
Posts: 77
Joined: Tue Sep 25, 2012 6:41 pm

Postby Dutch_Master » Tue Oct 30, 2012 10:56 pm

There's a distinct difference between /usr and "user" (as in: the actual person using the system)... The first is a directory, storing static stuff for applications and has its roots ( :P) in Unix design over 4 decades ago. ;)

Investigate about adding paths to your profile so Bash can find them.
Dutch_Master
LXF regular
 
Posts: 2459
Joined: Tue Mar 27, 2007 1:49 am

Postby SiriusHardware » Tue Oct 30, 2012 11:16 pm

Dutch_Master wrote:There's a distinct difference between /usr and "user" (as in: the actual person using the system)... The first is a directory, storing static stuff for applications and has its roots ( :P) in Unix design over 4 decades ago. ;)

Investigate about adding paths to your profile so Bash can find them.


I did try, that's the only reason I ended up looking at etc/profile


Actually, I erroneously remembered the word 'usr' rather than you (now corrected in the original post, apologies for the mixup) but I seem to have done the right thing anyway - I now have home/fred/bin, into which I have copied the files as per the instructions, but BASH does not seem to see XASM there.

Ok, here's the relevant bit from the program installation instructions:

Code: Select all
"For an installation for the current user only, copy the file XASM and the entire directory Xapack into the directory ~/bin . For the less experienced Linux users, the ~/bin directory is the directory /home/you/bin, where you is the user name you used during logon. If the directory ~/bin doesn't exist, create it before copying the files into it. Ubuntu will automatically add the directory ~/bin to your PATH, the next time you start a new bash shell. If your Linux/Unix version doesn't do that, include ~/bin yourself to the PATH variable in your ~/.profile file.


Looking at the section from /etc/profile in my previous post, do I need to add /home/fred/bin: to one of the existing PATH lines or both of them? Or do something else entirely?
Last edited by SiriusHardware on Tue Oct 30, 2012 11:29 pm, edited 1 time in total.
SiriusHardware
 
Posts: 77
Joined: Tue Sep 25, 2012 6:41 pm

Postby paulm » Tue Oct 30, 2012 11:25 pm

I use a ~/bin directory for my own scripts. And I make sure its in the path by adding this to my ~/.bashrc:

Code: Select all
if [ -d ~/bin ]; then
   PATH=~/bin:$PATH
fi


:) More complicated than it really needs to be, but it checks for the existence of a bin directory in my home directory and adds it to the path if one is found.

Paul.
paulm
LXF regular
 
Posts: 242
Joined: Mon Apr 03, 2006 4:53 am
Location: Oxfordshire, UK

Postby SiriusHardware » Tue Oct 30, 2012 11:43 pm

paulm wrote:I use a ~/bin directory for my own scripts. And I make sure its in the path by adding this to my ~/.bashrc:

Code: Select all
if [ -d ~/bin ]; then
   PATH=~/bin:$PATH
fi


:) More complicated than it really needs to be, but it checks for the existence of a bin directory in my home directory and adds it to the path if one is found.

Paul.


OK Paul, I'll have a look in that direction, thanks.
SiriusHardware
 
Posts: 77
Joined: Tue Sep 25, 2012 6:41 pm


Return to Help!

Who is online

Users browsing this forum: No registered users and 3 guests