Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > /usr/bin/open, xargs, and tilde expansion

/usr/bin/open, xargs, and tilde expansion
Thread Tools
Fresh-Faced Recruit
Join Date: Oct 2000
Location: ny, ny, ny
Status: Offline
Reply With Quote
Jul 18, 2004, 11:57 PM
 
Is there any way to simply tell a shell to "return the expanded form of this tilde-abbreviated path"?

I'm trying to modify the 'Open Selection In TextEdit' script that comes with TextExtras into an 'Open Selection' script for use in SubEthaEdit, but I can't get it to work with paths with tildes in them.

The one line in my script (besides the TextExtras stuff) is:

Code:
xargs -0 open
But I just get
Code:
No such file: ~/Pictures
on STDERR from the open tool.

I was thinking of using something like
Code:
xargs -I % open `(tell shell to expand path here)%`
but have no idea how to do that, or if there's a better way.

I don't know if this is an xargs issue, an open issue, or a general shell issue. I think it's open though, since everything works OK when using xargs with another tool, e.g. find.

FWIW, the TextExtras script doesn't expand tildes either, and open gives the same error if I execute open with the path quoted from the command line.

Any help is appreciated, including pointing me on the right track if I'm on the wrong one.
     
Forum Regular
Join Date: Mar 2001
Location: Sydney, Australia
Status: Offline
Reply With Quote
Jul 26, 2004, 09:53 AM
 
Originally posted by endian:
Is there any way to simply tell a shell to "return the expanded form of this tilde-abbreviated path"?
Maybe I'm not understanding you but what about
Code:
echo ~/Perl /Users/mymac/Perl
BASH has expanded the ~/ to the home directory
iMac G4 800Mhz, 1Gb; Mac OS 10.3; Canon S200SP; Zip 250 USB; Canon MV30i; iPod 40Gb; Canon PowerShot G3; UMAX 1220U
iMac Rev A, 96Mb, MacOS 9.2.2
     
   
Thread Tools
Forum Links
Forum 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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 12:13 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2