I
I
ivan_ivan_sobolev2021-10-31 17:48:20
linux
ivan_ivan_sobolev, 2021-10-31 17:48:20

Why doesn't the mkdir 1 | mkdir 1/2"?

I want to create directory 1, and put directory 2 in it.
I know that I can do it differently, but I need to understand why this method does not work.
Gives an error message:

mkdir: Failed to make directory "1/2"; No such file or directory
, but it creates directory 1.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Karabanov, 2021-10-31
@ivan_ivan_sobolev

Create a directory named 1 and, if successful, execute another command that will create subdirectory 2 in directory 1:
mkdir 1 && mkdir 1/2
And this is mkdir 1 | mkdir 1/2not a logical operator, but pipe - a pipe for directing output to another application.

V
Vitaly Karasik, 2021-10-31
@vitaly_il1

mkdir -p 1/2/3/4/5

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question