小编wen*_*ing的帖子

如何限制Rsync更新时间戳

rsync -av --size-only --include="*/" --include="*.jpeg" --exclude="*" ~/alg/temperature/ ~/alg/tmp/
Run Code Online (Sandbox Code Playgroud)

我使用上面的命令来同步一些文件,如果文件大小相同,我甚至不想更新任何时间戳

选项--size-only只能同步更改大小的文件

但那些没有变化的大小将被"触及"并更新时间戳,这是我不想要的

我该怎么做?

rsync

6
推荐指数
1
解决办法
4024
查看次数

退出在bash中不起作用

下面是bash脚本

#!/bin/bash
set -x
function doSomething() {
    callee
    echo "It should not go to here!"
}

function callee() {
    ( echo "before" ) && (echo "This is callee" && exit 1 )                                                                                   
    echo "why I can see this?"
}


doSomething
Run Code Online (Sandbox Code Playgroud)

这就是结果......

+ set -x
+ doSomething
+ callee
+ echo before
before
+ echo 'This is callee'
This is callee
+ exit 1
+ echo 'why I can see this?'
why I can see this?
+ echo 'It should not …
Run Code Online (Sandbox Code Playgroud)

bash

4
推荐指数
1
解决办法
2501
查看次数

bash return在echo"aa"中没有预期的效果 读ln

#!/bin/bash

function doSomething() {
    callee
    echo $?
    echo "It should go to here!"
}

function callee() {
    cat line.txt |while read ln
    do
        echo $ln
        if [ 1 ] ;then
            { echo "This is callee" &&
            return 2; }
        fi  
    done
    echo "It should not go to here!"
}


doSomething
Run Code Online (Sandbox Code Playgroud)

结果如下

aa
This is callee
It should not go to here!
0
It should go to here!
Run Code Online (Sandbox Code Playgroud)

为什么"回归"就像"休息"一样?

我希望它退出功能!不仅打破了循环......

bash

1
推荐指数
1
解决办法
455
查看次数

标签 统计

bash ×2

rsync ×1