in Others recategorized by
2,969 views
3 votes
3 votes

In UNIX, ____ creates three subdirectories; 'PIS' and two subdirectories 'progs' and 'data' from just created subdirectory 'PIS'

  1. mkdir PIS/progs PIS/data PIS
  2. mkdir PIS progs data
  3. mkdir PIS PIS/progs PIS/data
  4. mkdir PIS/progs data
in Others recategorized by
3.0k views

1 Answer

1 vote
1 vote
C is Ans

mkdir PIS PIS/progs PIS/data

Creates PIS parent directory first then inside that two sub directories namely progs and data are  created.

But I would do like this to get the same effect:-

mkdir -p PIS /{progs,data}

The above creates the top-level directory PIS, along with all of the subdirectories PIS/progs,PIS/data,).

How does it work? There are two things of note about the command above:

The -p flag: This tells mkdir to create any leading directories that do not already exist. Effectively, it makes sure that PIS gets created before creating PIS/progs.

The {} lists: The technical name for these is "brace expansion lists". Basically, the shell interprets this as a list of items that should be appended individually to the preceding path. Thus, a/{b,c} is expanded into a/b a/c.
edited by
Answer:

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true