lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Mon, Aug 30, 2010 at 10:06 PM, soly man <luascript2010@gmail.com> wrote:
>
>
> Dear friends
>
> I am using the Microsoft windows version of the extra putty software to
> telnet a UNIX machine
>

Can't you configure some SSH? It's safer...

> via extra putty software I got lua  code which checks if file exist on my
> windows harddisk (local machine)
>
> code is:
>
> 	  local file = io.open(c:\\file.txt)
> 	  if file then
> 	    io.close(c:\\file.txt)
> 	    return true
> 	  else
> 	    return false
> 	  end
> 	end
>

Aren't we missing some quotes there? And what does PuTTY has to do
with the local code?

>  now i want to have lua code which checks if file exist on UNIX (remote
> machine) not local  , so is it possible to use the following code
>
> remember i am running the lua script on windows and i am woundering if it
> recognize  /usr/bin/script.s of the remote unix or not

No, it won't.

>
>
> code is :
>
>   local file = io.open(/usr/bin/script.sh)
> 	  if file then
>
> 	    io.close(/usr/bin/script.sh)
>
>
> 	    return true
> 	  else
> 	    return false
> 	  end
> 	end
>
> plz send me the right way to do that
>
> thank you
>
>
> soly


I can imagine two ways: One is to mount the remote directory on a
local folder. The local Lua then wouldn't have any problem since as
far as it knows it's accessing a local filesystem.

The other is to try to use some of the features provided by LuaSocket.


If you could be clearer on what's local and what's remote I think it
would be easier to tell.


att.

--ad.ad