在 Bash 脚本中,我试图将我使用的选项存储rsync在一个单独的变量中。这适用于简单的选项(如--recursive),但我遇到了--exclude='.*'以下问题:
$ find source
source
source/.bar
source/foo
$ rsync -rnv --exclude='.*' source/ dest
sending incremental file list
foo
sent 57 bytes received 19 bytes 152.00 bytes/sec
total size is 0 speedup is 0.00 (DRY RUN)
$ RSYNC_OPTIONS="-rnv --exclude='.*'"
$ rsync $RSYNC_OPTIONS source/ dest
sending incremental file list
.bar
foo
sent 78 bytes received 22 bytes 200.00 bytes/sec
total size is 0 speedup is 0.00 (DRY RUN)
Run Code Online (Sandbox Code Playgroud)
As you can see, passing --exclude='.*' …
我有一个第 3 方 SFTP 服务器,我想在其中检查一些文件时间戳。
ls -l但是,如果我使用vs. ,同一文件确实会得到不同的结果ls -lh:
sftp> ls -l
[...]
-rwxrwxrwx 1 0 0 1963 Nov 15 08:49 foo.txt
[...]
sftp> ls -lh
[...]
-rwxrwxrwx 0 0 0 1.9K Nov 15 07:49 foo.txt
[...]
sftp> ls -l foo.txt
-rwxrwxrwx 0 0 0 1963 Nov 15 07:49 foo.txt
sftp> ls -lh foo.txt
-rwxrwxrwx 0 0 0 1.9K Nov 15 07:49 foo.txt
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,时间戳为 ,而其他命令的时间戳ls -l为。服务器位于德国,目前比 UTC 晚 1 小时,所以我的猜测是UTC 时间,而柏林时间。08:4907:4907:4908:49 …