Welcome to MacForumz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Get hostname & pwd from terminal ssh session

 
   Macintosh computer (Home) -> Apple Scripts RSS
Next:  how is "Microtek Scanner Finder" auto-o..  
Author Message
algo

External


Since: Dec 07, 2008
Posts: 2



(Msg. 1) Posted: Sun Dec 07, 2008 2:32 pm
Post subject: Get hostname & pwd from terminal ssh session
Archived from groups: alt>comp>lang>applescript (more info?)

I have open SSH session in Terminal.

How can I get current hostname and working dir from that session ?

I tried "do shell script hostname", but that returns hostname of my
host, not remote computer.

I also tried ways like

do script "echo `pwd``" in (selected tab of win)
set dir to (get contents of (selected tab of win))

But result of pwd command appears in terminal contents only after
applescript finishes.

What to do ?


P.S
Actually I want SSH hostname & pwd to open /Volumes/<hostname><pwd>
folder in finder, so I can easily "chdir" to remote host (mounted
using sshfs to /Volumes/<hostname>).

 >> Stay informed about: Get hostname & pwd from terminal ssh session 
Back to top
Login to vote
Jolly Roger

External


Since: Sep 09, 2006
Posts: 3131



(Msg. 2) Posted: Sun Dec 07, 2008 4:36 pm
Post subject: Re: Get hostname & pwd from terminal ssh session [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article
,
algo wrote:

> I have open SSH session in Terminal.
>
> How can I get current hostname and working dir from that session ?
>
> I tried "do shell script hostname", but that returns hostname of my
> host, not remote computer.
>
> I also tried ways like
>
> do script "echo `pwd``" in (selected tab of win)
> set dir to (get contents of (selected tab of win))
>
> But result of pwd command appears in terminal contents only after
> applescript finishes.
>
> What to do ?
>
>
> P.S
> Actually I want SSH hostname & pwd to open /Volumes/<hostname><pwd>
> folder in finder, so I can easily "chdir" to remote host (mounted
> using sshfs to /Volumes/<hostname>).

AppleScript isn't the right tool for this job.

--
Send responses to the relevant news group rather than email to me.
E-mail sent to this address may be devoured by my very hungry SPAM
filter. Due to Google's refusal to prevent spammers from posting
messages through their servers, I often ignore posts from Google
Groups. Use a real news client if you want me to see your posts.

JR

 >> Stay informed about: Get hostname & pwd from terminal ssh session 
Back to top
Login to vote
algo

External


Since: Dec 07, 2008
Posts: 2



(Msg. 3) Posted: Mon Dec 08, 2008 12:27 am
Post subject: Re: Get hostname & pwd from terminal ssh session [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On 8 ÄÅË, 01:36, Jolly Roger wrote:
> In article
> ,
>
>
>
> šalgo wrote:
> > I have open SSH session in Terminal.
>
> > How can I get current hostname and working dir from that session ?
>
> > I tried "do shell script hostname", but that returns hostname of my
> > host, not remote computer.
>
> > I also tried ways like
>
> > š š do script "echo `pwd``" in (selected tab of win)
> > š š set dir to (get contents of (selected tab of win))
>
> > But result of pwd command appears in terminal contents only after
> > applescript finishes.
>
I want to call command in terminal and get its output
while in SSH.

And then use Finder to open the folder.

It seems there is nothing more suitable then AS


> > What to do ?
>
> > P.S
> > Actually I want SSH hostname & pwd to open /Volumes/<hostname><pwd>
> > folder in finder, so I can easily "chdir" to remote host (mounted
> > using sshfs to /Volumes/<hostname>).
>
> AppleScript isn't the right tool for this job.
>
> --
> Send responses to the relevant news group rather than email to me.
> E-mail sent to this address may be devoured by my very hungry SPAM
> filter. Due to Google's refusal to prevent spammers from posting
> messages through their servers, I often ignore posts from Google
> Groups. Use a real news client if you want me to see your posts.
>
> JR
 >> Stay informed about: Get hostname & pwd from terminal ssh session 
Back to top
Login to vote
Christian Borgsen

External


Since: Nov 08, 2007
Posts: 4



(Msg. 4) Posted: Wed Dec 10, 2008 11:26 am
Post subject: Re: Get hostname & pwd from terminal ssh session [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

algo wrote:

> Actually I want SSH hostname & pwd to open /Volumes/<hostname><pwd>
> folder in finder, so I can easily "chdir" to remote host (mounted
> using sshfs to /Volumes/<hostname>).

man open

--
Christian Borgsen
PGP-Key available on request
"Misstraut jeder Ideologie!
Kritik ist wichtiger als Dogma!"
 >> Stay informed about: Get hostname & pwd from terminal ssh session 
Back to top
Login to vote
Simon Slavin1

External


Since: May 16, 2004
Posts: 375



(Msg. 5) Posted: Sun Dec 21, 2008 7:27 pm
Post subject: Re: Get hostname & pwd from terminal ssh session [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On 07/12/2008, algo wrote in message <947b74df-cee0-4e9c-86b7-
f7f80a81f751.TakeThisOut@j11g2000yqg.googlegroups.com>:

> Actually I want SSH hostname & pwd to open /Volumes/<hostname><pwd>
> folder in finder, so I can easily "chdir" to remote host (mounted
> using sshfs to /Volumes/<hostname>).

Use a script on the /target/ machine which performs your chdir command
using system variables which are local to /that/ machine. e.g.

chdir $user

Simon.
--
http://www.hearsay.demon.co.uk
 >> Stay informed about: Get hostname & pwd from terminal ssh session 
Back to top
Login to vote
Display posts from previous:   
   Macintosh computer (Home) -> Apple Scripts All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]