rsync -av --size-only --include="*/" --include="*.jpeg" --exclude="*" ~/alg/temperature/ ~/alg/tmp/
Run Code Online (Sandbox Code Playgroud)
我使用上面的命令来同步一些文件,如果文件大小相同,我甚至不想更新任何时间戳
选项--size-only只能同步更改大小的文件
但那些没有变化的大小将被"触及"并更新时间戳,这是我不想要的
我该怎么做?
下面是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) #!/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)
为什么"回归"就像"休息"一样?
我希望它退出功能!不仅打破了循环......