LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-28-2008, 02:08 PM   #1
teddyt
Member
 
Registered: Dec 2007
Location: US
Distribution: Slackware 12.1
Posts: 119

Rep: Reputation: 15
Set path for individual files


Is there a way to set the PATH that will be checked in a way that is specific to individual files?

The problem I have is that I have unfortunately mixed in a few datafiles with the same names in different directories. I have some binaries (not all the source) and when I run those files it might look in the wrong directory and pull in the wrong dataset.

What I would like is to be able to have all of the files in one directory look in one set of directories for the datafiles, and all the files in another directory look in a different set of directories.

Any suggestions? I'm guessing there is a simple command to do that, but cannot find what that command is.
 
Old 04-28-2008, 03:12 PM   #2
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
...I'm not entirely clear on what you want (but my brain's frazzled from writing project descriptions for tax returns all day).

If you want a method to discriminate "/usr/bin/bin1" and "/usr/local/bin/bin1" try adding an alias to your ~/.bashrc file:
Code:
# Assuming you want the program in /usr/bin
alias bin1='/usr/bin/bin1'
Then afterwards, just
Code:
$ source ~/.bashrc
to refresh your environment.
 
Old 04-30-2008, 08:22 PM   #3
teddyt
Member
 
Registered: Dec 2007
Location: US
Distribution: Slackware 12.1
Posts: 119

Original Poster
Rep: Reputation: 15
Thanks, I didn't know about alias before.

I checked it out and it doesn't appear that will do exactly what I need, unfortunately, because I'd have to issue the source command by hand before running each file. My search lead me to conclude that I probably can only achieve what I need using chroot, which is a lot of work, at least for someone who's never done it before.

I'll probably just move some of the directories into a virtual machine.

Thanks for your help.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to set path for downloading files for wget vineet7kumar Linux - Newbie 2 04-24-2008 04:38 AM
Set the path systemwide/Set the path for a user with Slackware jayhel Slackware 1 06-12-2005 12:24 AM
Passwording individual files SuSE05 Linux - Software 4 04-20-2005 06:14 AM
How to set PATH How do I set PATH environment variable? Tranquil Linux - Newbie 3 11-02-2003 02:52 AM
Burning individual files... nutshell Linux - General 4 03-02-2002 09:21 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:40 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration