recategorized by
2,964 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
recategorized by

1 Answer

1 votes
1 votes
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

0 votes
0 votes
1 answer
1
makhdoom ghaya asked Jul 10, 2016
1,562 views
Match the following with reference to Unix shell scripts $:$$\begin{array}{clcl} & \textbf{List – I} & & \textbf{List – II} \\ \text{a.} & \text{\$?} & \text{i.} & ...
4 votes
4 votes
1 answer
2