Почему Interix mkdir не учитывает аргумент -p?

375
WilliamKF

Я использую Interix на Windows для совместимости с Unix и нахожу -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. 

Справочная страница SUA для mkdir частично описывает:

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

1 ответ на вопрос

0
WilliamKF

The windows mkdir was being picked up instead of the Interix one. I avoid the issue by giving full path to Interix's mkdir location. This was needed even though which mkdir gave the Interix one.

Возможно, вам нужно исправить переменную PATH? Lie Ryan 11 лет назад 0
@Lie Райан Но если это был путь, то почему `which mkdir` показал тот, который я хочу? WilliamKF 11 лет назад 0

Похожие вопросы