sh DS_Store实用程序用于Bash和ZSH
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh DS_Store实用程序用于Bash和ZSH相关的知识,希望对你有一定的参考价值。
ds_store_files_count () {
print_horizontal_line
printf "Counting '.DS_Store' Files "
printf "."
sleep 0.2
printf "."
sleep 0.2
printf "."
sleep 0.2
printf "."
sleep 0.2
printf ".\\n"
sleep 0.2
print_horizontal_line
find `pwd` -type f -regex ".*\/.DS_Store$" -exec echo {} \; | wc -l
}
alias ds_store_files_view="ds_store_files_see"
ds_store_files_see () {
print_horizontal_line
printf "Displaying All '.DS_Store' Files .....\\n"
print_horizontal_line
find `pwd` -type f -regex ".*\/.DS_Store$" -exec echo {} \;
}
alias ds_store_files_remove="ds_store_files_delete"
ds_store_files_delete () {
print_horizontal_line
printf "DELETING All '.DS_Store' Files .....\\n"
print_horizontal_line
find `pwd` -type f -regex ".*\/.DS_Store$" -exec rm -rf {} \;
}
alias ds_store_files_remove_verbose="ds_store_files_delete_verbose"
ds_store_files_delete_verbose () {
print_horizontal_line
printf "DELETING All '.DS_Store' Files .....\\n"
print_horizontal_line
find `pwd` -type f -regex ".*\/.DS_Store$" -exec rm -vrf {} \;
}
print_horizontal_line () {
# convert input params to lowercase
COUNT=$( echo "$1" | tr '[A-Z]' '[a-z]' )
# COUNT=$( echo "$1" | tr '[:upper:]' '[:lower:]' )
if [[ "$COUNT" = false || "$COUNT" = "blank" ]]; then
# if the first paramater is false or "blank", then print one blank line ('\n')
printf '\n'
return
elif [[ -z "$COUNT" || "$COUNT" -le 1 ]]; then
# else, if the first paramater doesn't exist or is <= 1, then print one horizontal line
printf '%50s\n' | tr ' ' -
return
else
# otherwise, print "$COUNT"-number of horizontal lines
for (( i = 0; i < $COUNT; i++ )); do
printf '%50s\n' | tr ' ' -
done
fi
}
以上是关于sh DS_Store实用程序用于Bash和ZSH的主要内容,如果未能解决你的问题,请参考以下文章
sh 适用于zsh或bash的virtualenv的实用程序功能。 virtualenv和virtualenvwrapper是必要的进步。
如何通过 Shell (BASH/ZSH/SH) 获取文件的绝对路径?
sh 盐bash zsh completition
如何更换linux bash 为zsh
bash和sh的区别
Zsh和oh my zsh的安装和使用