-
-
Save takuya/43f4d395ab9513102e19c4689922cec7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# alias の代替にfunction を定義 | |
function find(){ | |
local post=() | |
local pre=() | |
local opts=() | |
local path='' | |
local mindepth=1 | |
while [[ $1 ]]; do | |
case "$1" in | |
-H | -L | -P ) pre+=($1);; | |
-O | -D ) pre+=($1); shift ; pre+=($1);; | |
-maxdepth ) opts+=($1); shift; opts+=($1) ;; | |
-mindepth) shift; mindepth=($1);; | |
* ) | |
if [[ -e $1 ]]; then | |
path="$1" | |
else | |
post+=("$1") | |
fi | |
esac | |
shift | |
done | |
# cmd=$(echo $( which find ) ${pre[@]} "$path" -mindepth $mindepth "${opts[@]}" -not -iwholename *.git* ) | |
# echo $cmd "${post[@]}" | |
# $cmd "${post[@]}" | |
cmd=$(echo $( which find ) ${pre[@]} "$path" -mindepth $mindepth "${opts[@]}" -not -iwholename "*.git/*" "${post[@]}" ) | |
(>&2 echo $cmd) | |
$cmd | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment