例如
f_list = $(eval ls "$1")
其中,如果 eval 刪掉
f_list = $(ls "$1")
姊果 f_list 的內容相同。看到 這一篇 說明,決的得很清楚:
1) foo=10 x=foo 2) y='$'$x 3) echo $y 4) $foo 5) eval y='$'$x 6) echo $y 7) 10
#!/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
$ssh-keygen -t rsa
$scp .ssh/id_rsa.pub a_server:~
$cat id_rsa.pub >> .ssh/autorized_keys
$ ssh-add Identity added: /home/charles-chang/.ssh/id_rsa (/home/charles-chang/.ssh/id_rsa)
Agent admitted failure to sign using the key.