Check if directory exists on remote machine with ssh

bash, ssh

Solution

This is a one liner:

ssh armand@127.0.0.1 '[ -d Documents ] && echo exists || echo does not exist'

Problem

This question has been already posted but I would like to know if there is a way to know if a directory exists on a remote machine with ssh BUT from the command line directly and not from a script. As I saw in this previous post: How to check if dir exists over ssh and return results to host machine, I tried to write in the command line the following: ``` ssh armand@127.0.0.1 '[ -d Documents ]' ``` But this does not print anything. I would like to know if there's a way to display an answer easily.

Original source

Related problems