"${filename...}"
例如:把所有 mp4 檔 rename 成 avi:
for file in *.mp4;do mv "$file" "${file/.mp4/.avi}";done
像這個 ${file/.mp4/.avi} 就是把 $file 中 .mp4 換成 .avi,其中的兩個 "/" 符號就是 replace。
ref:
"${filename...}"
for file in *.mp4;do mv "$file" "${file/.mp4/.avi}";done
sed '/match string/d' file > out
sed '/match string/d' infile > outsed '/stringA/d' -e '/stringB/d' -e '/stringC/d' infile > out# delabc : del stringA.B.C
/stringA/d
/stringB/d
/stringC/d
sed -f delabc infile > out#mount -o umask=0002 /dev/sdd1 /sd
rwxrwxr-x
if [ -f /etc/passwd ]; then
echo "found"
else
echo "not found"
fi[ -e file ] file exists
[ -f file ] file is a file
[ -d file ] file is a directory
[ -c file ] file is a character device
[ -b file ] file is a block device
[ -p file ] file is a named pipe
[ -s file ] file is not empty
[ -k file ] file's sticky bit is set
[ -S file ] file is a socket
[ -L file ] file is a symbolic link
[ -r file ] file is readable by user
[ -w file ] file is writeable by user
[ -x file ] file is executeable by user
[ -O file ] file is owner by user
[ -G file ] file is group owned by a greoup
[ -u file ] file has its set user ID bit set
[ -g file ] file has its group user ID bit set
[ file1 -nt file2 ] file1 is newer than file2
[ file1 -ot file2 ] file1 is older than file2
[ file -ef file2 ] file1 is another name for file2[ $str1 = $str2 ] str1 string is the same as string str2
-a and
-o or
! not$ find . -name RefBase.cpp | xargs -I src cp src ~/testset -eset +e