|
Debian参考手册上,“8.3.1 拷贝整个子目录的基本命令”中有个命令是:
如果是远程操作:
# (cd /source/directory && tar cf - . ) | \
ssh user@host.dom (cd /dest/directory && tar xvfp - )
这个命令有错,ssh 后面的命令( )两边要加上"( )"。
正确写法是:
# (cd /source/directory && tar cf - . ) | \
ssh user@host.dom "(cd /dest/directory && tar xvfp - )"
请看我的演示:
错误的
[hwy@fzimc hwy]$ ssh oracle@10.214.0.122 (cd /tmp&&ls -l)
bash: syntax error near unexpected token `('
[hwy@fzimc hwy]$
正确的
[hwy@fzimc hwy]$ ssh oracle@10.214.0.122 "(cd /tmp&& ls -l)"
oracle@10.214.0.122's password:
total 269164
-r-xr-xr-x 1 root root 29583360 Aug 28 2003 comm_ds65_redhat.tar
-r-xr-xr-x 1 root root 20480 Aug 28 2003 conf_file_linux.tar
-r-xr-xr-x 1 root root 93909 Aug 28 2003 glibc-2.1.3-stubs.tar.gz
-r-xr-xr-x 1 root root 18801362 Aug 28 2003 i386-glibc-2.1-linux.tar.gz
-r-xr-xr-x 1 root root 14118801 Aug 28 2003 jdk118_v3-glibc-2.1.3.tar.bz2
drwx------ 2 root root 4096 Aug 29 2003 ksocket-root
drwx------ 2 root root 16384 Aug 28 2003 lost+found
-r-xr-xr-x 1 root root 10240 Aug 28 2003 myapp.tar
drwx------ 2 oracle dba 4096 Sep 9 2003 orbit-oracle
drwx------ 2 root root 8192 Dec 28 2004 orbit-root
drwx------ 2 user user 4096 Aug 28 2003 orbit-user
drwx------ 2 yzpp dba 4096 Aug 31 2003 orbit-yzpp
prw-r--r-- 1 root root 0 Dec 29 2003 pipe1
drwx------ 2 root root 4096 Aug 31 2003 ssh-XXXiEmox
-r-xr-xr-x 1 root root 98283520 Aug 28 2003 tuxedo.528.msserver.tar
-r-xr-xr-x 1 root root 39629000 Aug 28 2003 tuxedo80_win.exe
-r-xr-xr-x 1 root root 74715136 Aug 28 2003 yzpp_redhat.dmp
[hwy@fzimc hwy]$ |
|