
Estoy usando Interix en Windows para compatibilidad con Unix y encuentro el -p
argumento para mkdir
no comportarme como esperaba:
> which mkdir
C:\SFU\bin\mkdir
> mkdir -p c:\Program Files\
A subdirectory or file -p already exists.
Error occurred while processing: -p.
La página de manual de SUA para mkdir indica en parte:
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.
¿Por qué recibo un error sobre el directorio existente aunque aprobé -p
? Parece que -p
no se reconoce como una bandera y en su lugar está creando un directorio llamado -p
. ¿Cómo se pasa el -p
argumento?
Respuesta1
mkdir
Se estaban levantando las ventanas en lugar de la de Interix. Evito el problema dando la ruta completa a mkdir
la ubicación de Interix. Esto era necesario a pesar de que which mkdir
le di uno a Interix.