emanuele6 1627215910 learn `find "$dir" -- -type f': this is problematic if $dir starts with '-'; a solution is to use `find "${dir/#-/./-}" -type f' (i.e. prepend './' to $dir only if $dir begins with '-') emanuele6 1627215966 forget emanuele6 1627215983 learn `find "$dir" -type f' is problematic if $dir starts with '-'; a solution is to use `find "${dir/#-/./-}" -type f' (i.e. prepend './' to $dir only if $dir begins with '-') emanuele6 1648897760 forget emanuele6 1648898099 learn `find "$dir" -type f' is problematic; if $dir starts with '-' or is '(' ')' or '!' (also ',' in GNU find), it will be interpreted as either an option or as part of the find expression; a possible solution is to use `[[ $dir == /* ]] || dir=./$dir' (or `case $dir in /*) dir=./$dir; esac' if using POSIX) before running `find "$dir" ...'. In bash 5.2, a simpler solution is to use `find emanuele6 1648898110 forget emanuele6 1648898155 learn `find "$dir" -type f' is problematic; if $dir starts with '-' or is '(' ')' or '!' (also ',' in GNU find), it may be interpreted as an option or as part of the find expression; a possible solution is to use `[[ $dir == /* ]] || dir=./$dir' (POSIX: `case $dir in /*) dir=./$dir; esac') before running `find "$dir" ...'. In bash 5.2, a simpler solution is to use `find "${dir/#[!/]/./&}" ...' emanuele6 1660480462 forget emanuele6 1660480525 learn `find "$dir" -type f' is problematic; if $dir starts with '-' or is '(' ')' or '!' (also ',' in GNU find), it may be interpreted as an option or as part of the find expression; a possible solution is to use `[[ $dir == /* ]] || dir=./$dir' (POSIX: `case $dir in /*) dir=./$dir; esac') before running `find "$dir" ...'. In bash 5.2, a simpler solution is to use `find "${dir/#[!\/]/./&}"