Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


How to check it on a remote machine?

Posted on 2006-10-25
Medium Priority
Last Modified: 2010-04-20


How can I run

                         if [ -e $SOME_PAH ]

on a remote machine as I do on a local?

I tried  ssh  $REMOTE_MACHINE  ls  $SOME_PATH which works fine but I think it is no reliable. Also I tried

fyn = `  ssh $REMOTE_MACHINE [ -e $SOME_PATH] $$ echo y `

but does'nt work!

any comments or advice?

Question by:akohan
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Author Comment

ID: 17807914

It was funny since the second statement now it is working!!!  I had left a space after and after equal sign!

However, does anybody can give me a better way?

LVL 24

Accepted Solution

slyong earned 252 total points
ID: 17808305

fyn=`ssh $REMOTE_MACHINE "[ -e $SOME_PATH ] && echo y"`

should work just fine.. may be is the " thing
LVL 48

Assisted Solution

Tintin earned 248 total points
ID: 17808454

if [ -n "`ssh $REMOTE_MACHINE \"[ -e $SOME_PATH ] && echo y`\"" ]

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses
Course of the Month10 days, 10 hours left to enroll

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question