Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
为了更舒适,我喜欢像这样覆盖 mkdir:
mkdir() { if [[ "$@" == *--parents* ]]; then builtin mkdir "$@" else builtin mkdir "$@" --parents fi }
不幸的是,没有内置的 mkdir。我怎样才能做一个解决方法来完成这项工作?
您可以改用command内置的:
command
mkdir() { if [[ "$@" == *--parents* ]]; then command mkdir "$@" else command mkdir "$@" --parents fi }
mkdir_p=`which mkdir`
之后,您可以使用以下命令调用它:
$mkdir_p args...
或者
alias mkdir=¨mkdir -p¨