How to check if a file exists on a server with bash

Checking if a file exists on my computer is easy. But how about checking if this file exist on my server?

If my file is:

host@server:/path/to/my/file.txt

What do I need to do to check if it exists?

Answers


How about this?

ssh user@host 'if [ -f /path/to/my/file.txt ]; then echo yes; else echo no; fi'

Need Your Help

Custom skinned facebook like button using javascript SDK

jquery facebook facebook-graph-api facebook-like facebook-javascript-sdk

I have a custom image which I would like to use rather than the standard facebook like styled one. I have this working but it only 'shares' the page rather than 'liking' it.

What document compiler should be used with C# 3.0 XML documentation comments?

visual-studio-2010 documentation c#-3.0

I am wondering what documentation compiler other developers use to transform the C# 3.0 XML comments into documentation. I had experimented with the Microsoft supplied tool in Visual Studio 20005,...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.