|
|
Free scripts to improve UNIX/Finder interaction
I've installed posd and fdc in /usr/bin, and they both work fine by themselves.
However, cd "$(/usr/bin/posd)" doesn't seem to work in my shell (I'm using tcsh). I just get an error saying "Illegal variable name." Is there a different syntax that I need to use with tcsh to cd to the directory returned by running the posd command?
Free scripts to improve UNIX/Finder interaction
I've been using the bash shell for so long that I'm not sure about my csh syntax, but I think this should work:
First, put the new commands someplace conventional in your path, like /usr/local/bin. I think in csh type shells (such as tcsh) you need to type rehash now. Now you can just type the commands with no path. The alias you can define this way:
alias cdf "cd `posd`"
where those are backticks around the posd. That should be one way to do it.
Free scripts to improve UNIX/Finder interaction
Backticks alone will not work because they will be evaluated when the alias is defined, not in the current context of the shell. You can see this by looking at the output from You need to use the eval command, like this:
Free scripts to improve UNIX/Finder interaction
Right- I should have used single quotes, which does work (I just tested it in csh):
Free scripts to improve UNIX/Finder interaction
In c-shells (csh, tcsh), you want to use backticks (`) instead of the $() form. In this case, you would use:
cd "`/usr/bin/posd`" $(somecommand) is newer Bourne-style syntax supported by bash, ksh, zsh, etc. The advantage of using that syntax is that it is nestable. |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysLinks 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.13 seconds |
|