|
|
How do I tweak my PATH?A reader writes:
"I've got a few of your books and today picked up Wicked Cool Shell Scripts, which I'm very much looking forward to working with.
The standard way to alter your PATH is to add a line to your ~/.bash_login, ~/.profile or ~/.login file (depending on which shell you're using). Bash will read either of the first two filenames, but let's use ~/.bash_login for consistency sake.
Open up that file (or create one if you don't have it yet) by using vi, pico, emacs, jove, or whatever else is your favorite editor in Terminal.app. Then append your desired directory to the end of the existing PATH value like so: export PATH="${PATH}:/Users/joe/bin"Close that terminal window and open another (File -> New Shell), then type echo $PATH and you should see your specified path appended to the end. Then just make sure you have that directory (you can use mkdir ~/bin to create it if needed). Now you can drop scripts and programs into that file to your heart's content, and they'll automatically be found when you type in their names to the shell. Note that there's a slight variation on this that can work too, and that might be more commonly used, as demonstrated by this actual entry in my own ~/.bash_login file: PATH="${PATH}:/sw/bin:/usr/X11R6/bin:/Users/taylor/bin"; export PATHHope that helps clear things up!
Related Unix and Linux Help articles:
✔ Copy and Paste from the Mac OS X Command Line?
I am constantly running commands in Terminal.app on my MacBook and then copying and pasting the results into email messages or documents. Yes,...
✔ Shell script to convert lowercase to title case?As part of a project I'm working on, I find myself deep in a Linux shell script, needing to have a subroutine that...
✔ Can I script renaming files based on an XML data map?I have a folder full of files which are named with four digits and a file extension e.g. 0312.file and an XML-file describing...
✔ Test for valid numbers in a Bash shell script?In a different discussion on this site [see Redirecting input in a shell script] a visitor commented that "I was too busy trying...
✔ Review: iSSH for the iPad/iPhoneIf you're running an online business like I am, there are times when you need to connect and log in to the server...
Let's stay in touch!
Sign up for my weekly AskDaveTaylor Newsletter and you'll receive even more tech and gadget help
right to your inbox, along with exclusive news and industry updates. It's good stuff. I promise!
Categorized:
Unix and Linux Help
(Article 3689,
Written by Dave Taylor)
Tagged: Previous: How do I get my environment to come along when I "su"? Next: Chopping off the last field of each line? Reader Comments To Date:
Rather amazingly, there are no comments on this article yet.
I do have a comment, now that you mention it!Check This Out Too... |
Recent Entries
Look for Answers
Recommended
All Our Categories
Apple iPad Help
Articles and Reviews Auctions and Online Shopping Blogs and Blogging Building Web Site Traffic Business and Management Computer and Internet Basics d) None of the Above Facebook Help Google Gmail Help Google Plus Help HTML, JavaScript and Web Site Programming Industry News and Trade Shows iPhone and Cell Phone Help iPod, Sony PSP and MP3 Player Help Kindle Fire Help Mac OS X Help Pay Per Click (PPC) Advertising Pinterest Help Search Engine Optimization (SEO) Shell Script Programming Tech Support Video Help The Writing Business Twitter, LinkedIn and Social Network Help Unix and Linux Help Video Game Tips and Help Windows PC Help Find Me on Google+ ADT on G+ |