Re: Unix file path problems
Re: Unix file path problems
- Subject: Re: Unix file path problems
- From: John Hawkinson <email@hidden>
- Date: Tue, 29 Jun 2004 04:22:44 -0400
Christopher Nebel <email@hidden> wrote on Tue, 29 Jun 2004
at 00:42:08 -0700 in <
email@hidden>:
>
>Perhaps the .inputrc file needs to be specified in the C shell setup
>
>files?
>
>Which makes things quite complicated :(
>
>
Different shells tend to use differently named rc files, which makes at
>
least some sense when you consider the fact that they have incompatible
>
syntaxes. Your best bet is probably to add a ~/.tcshrc file that
>
simply says "source ~/.inputrc".
This is not going to help. The .inputrc file is read by the readline
library, and it sets readline-specific options with a
readline-specific syntax. Since bash uses readline (and thus
libreadline) for user input, it can be controlled in that fashion. Not
so for tcsh, which does not use readline at all.
If the goal is to open a Terminal in a particular directory,
it's going to be painful no matter what.
(Hmm, the rest of this message is really not so helpful. I
wonder if I'd have been better off deleting it. Be forewarned.)
One really bad choice might be:
tell application "Finder"
set myfolder to (target of front window as string)
set ppath to quoted form of POSIX path of myfolder
do shell script "cd " & ppath & "; ls -ldi . | awk '{print $1}' > /tmp/inum"
end tell
tell application "Terminal"
activate
do script "cd /.vol/*/`cat /tmp/inum`"
end tell
Which has several rather serious flaws:
a) It uses a temporary file that might not be unique (/tmp/inum)
b) It leaves you in /.vol/######/##### which, depending on your purpose,
might not be as good as "actually being there."
c) It doesn't even try to figure out the correct ##### for the device
and just assumes that * is good enough
Maybe it would be sufficent to just take the original
do script "cd " & pPath
and instead change it to
set doublequote to ascii character 34
do script " cd " & doublequote & pPath & doublequote
but this would fail if your directory name had double quotes in it, or
other shell metacharacters...
Traditionally in unix you'd solve this by changing the directory
before you start the program, e.g. by using xterm and
do shell script "cd " & pPath & "; xterm&"
but since Terminal.app is one process for all windows, that concept
doesn't work.
--jhawk
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.