
私は Unix との互換性のために Windows 上で Interix を使用していますが、期待どおりに動作しない-p
という問題が見つかりました。mkdir
> which mkdir
C:\SFU\bin\mkdir
> mkdir -p c:\Program Files\
A subdirectory or file -p already exists.
Error occurred while processing: -p.
mkdir の SUA マニュアル ページには、次のように記載されています。
NAME
mkdir - make directories
SYNOPSIS
mkdir [-p] [-m mode] directory_name [...]
DESCRIPTION
The mkdir utility creates the directories named as operands, in the order
specified, using mode rwxrwxrwx (0777) as modified by the current
umask(2).
-p Create intermediate directories as required. If this option is
not specified, the full path prefix of each operand must already
exist. Intermediate directories are created with permission bits
of rwxrwxrwx (0777) as modified by the current umask, plus write
and search permission for the owner. Do not consider it an error
if the argument directory already exists.
を渡したのに、既存のディレクトリに関するエラーが発生するのはなぜですか-p
? は-p
フラグとして認識されず、代わりに という名前のディレクトリを作成しているようです-p
。引数をどのように渡しますか-p
?
答え1
mkdir
Interix の代わりにウィンドウが取得されていました。この問題は、Interix のmkdir
場所への完全なパスを指定することで回避しました。Interix を指定した場合も、この操作が必要でしたwhich mkdir
。