#!/bin/bash if [ -L bbb ]; then echo OK fi如果 ls .. 中..
bbb --> aaa ..不管 aaa 在不在,都會 OK。
#!/bin/bash if [ -L bbb ]; then echo OK fi如果 ls .. 中..
bbb --> aaa ..不管 aaa 在不在,都會 OK。
#!/bin/bash
for f in *.MP4; do
ffmpeg -i "$f" -vf "transpose=1" "r${f%.MP4}.MP4"
done
stringZ=abcABC123ABCabc
# |----|
# |----------|
echo ${stringZ#a*C} # 123ABCabc
# Strip out shortest match between 'a' and 'C'.
echo ${stringZ##a*C} # abc
# Strip out longest match between 'a' and 'C'.
stringZ=abcABC123ABCabc
# ||
# |------------|
echo ${stringZ%b*c} # abcABC123ABCa
# Strip out shortest match between 'b' and 'c', from back of $stringZ.
echo ${stringZ%%b*c} # a
# Strip out longest match between 'b' and 'c', from back of $stringZ.
exit 123然後 caller 用 $? 就可以取得上一個 script exit 的值。
$ echo '0 [123] 456' | sed 's/\[.*\]//' 0 456