|
|
New Version for both Bash and Tcsh
Hey folks,
Apple provided us with the "defaults" command to deal with property lists. So, to read all key/value pairs in a very simple and effective way, you simply need defaults read "${HOME}/.MacOSX/environment"That said, the bash way suitable for 99 percent of all cases to include directly into .bashrc would read as follows (on a single line): defaults read "${HOME}/.MacOSX/environment" | tr -d "{" | tr -d "}" | sed 's{\ =\ {={g' | tr ";" "\n" | grep "=" | while read -r OneLine; do eval export $OneLine; doneCheers, Thomas
New Version for both Bash and Tcsh
Two small additions:
> the bash way suitable for 99 percent of all cases That means, this will work unless key or value contain "{", "}", or ";" because they will be converted while parsing the property list. > tr ";" "n"Should read "\n". The backslash character "\" has been eaten by the form submission, so once again:
|
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysNo new commentsLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.05 seconds |
|