从另一台服务器获取最新目录

时间:2013-02-26 11:01:25

标签: shell unix

Test1服务器: - ut1-2013.02。 26 -04.42.15,ut1-2013.02。 25 -09.21.11,ut1-2013.02。 21 < /strong>-09.22.32(Dir's) Test2服务器: - ut1-2013.02。 25 -09.21.11,ut1-2013.02。 21 -09.22.32

有两台服务器: - Test1和Test2 有目录: - 如上所示

test1服务器中的最新目录: - ut1-2013.02。 26 -04.42.15 test2服务器中的最新目录: - ut1-2013.02。 25 -09.21.11

当我从 test2服务器的命令行运行以下命令时

命令: - ssh test1 ls -ldt ut1 - ????。?? ?? ?? ?? ?? ?? ?? ?? ?? |头-1 -

我的输出为ut1-2013.02。 25 -09.21.11(test2服务器中的最新目录), 但是我期望在ut1-2013.02输出。 26 -04.42.15(test1服务器中的最新目录)?

请帮助我使用ssh从test2服务器获取最新目录ut1-2013.02。 26 -04.42.15

先谢谢

1 个答案:

答案 0 :(得分:1)

您需要用引号来包含文件规范 - 否则规范将由本地shell解释。

ssh test1 ls -ldt "ut1-????.??.??-??.??.??" | head -1