LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 11-23-2011, 07:03 AM   #1
hashbang#!
Member
 
Registered: Aug 2009
Location: soon to be independent Scotland
Distribution: Debian
Posts: 120

Rep: Reputation: 17
[bash] add multiple directories to $PATH


I have several project folders under ~/development. Each project folder contains an sbin directory.

In .bashrc, I'd like to prepend all of those sbins in a oner.

I came up with:
Code:
PATH=$(find ~/development -type d -name sbin -printf '%p:\n')$PATH
Has anyone got better ideas?
 
Old 11-23-2011, 07:29 AM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
Not any better but if you put a newline at the end of each directory found is this not going to make your path a little strange?
 
Old 11-23-2011, 09:02 AM   #3
hashbang#!
Member
 
Registered: Aug 2009
Location: soon to be independent Scotland
Distribution: Debian
Posts: 120

Original Poster
Rep: Reputation: 17
Oops - it actually didn't do any harm - it was ignored.
 
  


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
Deleting remote directories on multiple hosts with a bash script zirtik Programming 6 04-16-2009 09:52 AM
Add to PATH (bash) for All Users (Suse) davidstvz Linux - Newbie 21 08-16-2008 04:48 PM
create multiple directories in bash? Count Zero Programming 19 07-06-2008 08:34 AM
add path and variables bash malcolmBl Linux - Newbie 3 05-18-2006 05:11 AM
BASH scripting browsing multiple directories PokerFace Programming 3 10-02-2002 12:50 PM

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

All times are GMT -5. The time now is 05:23 AM.

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