I have been trying to figure this out tried different commands and still have gotten no where. Can you please help me with this question?

In your home directory, create a subdirectory called shirts. Within the subdirectory, create 108 files with file names of the form style.size.color.ext, where each file contains one combination of values from the following table.

Style   tee, crew, turtleneck
Size    XXL, XL, L, M, S, XS
Color   red, yellow, blue
Extension   info, inv

This is the last command I used.

$ touch shirts/{tee,crew,turtleneck}.{XXL,XL,L,M,S,XS}.{red,yellow,blue}/{info,inv}
  • 4
    Did you already mkdir shirts? – glenn jackman Jun 14 '14 at 15:42

There is a slight error in your touch command. Your original command,

touch shirts/{tee,crew,turtleneck}.{XXL,XL,L,M,S,XS}.{red,yellow,blue}/{info,inv}

In the end there is a / which again tries to create a directory and since the directory doesn't exist you will get an error as,

touch: cannot touch `/shirts/turtleneck.XS.blue/inv': No such file or directory

However, since you need only files, you need to change your original command as,

touch shirts/{tee,crew,turtleneck}.{XXL,XL,L,M,S,XS}.{red,yellow,blue}.{info,inv}

P.S: You need to make sure that the directory shirts already exists. Otherwise, you will again get the same error cannot touch.

  • Thank you so much, the first time I attemped the command I did it correctly with the . instead of the / at the end. I did not do mkdir shirts. Its always something basic I over look. I am a new student thank you again. – user72510 Jun 14 '14 at 16:24
  • 2
    You are welcome. If this resolves the issue, please accept the answer so that the question is resolved :) – Ramesh Jun 14 '14 at 16:27
  • its is spelt it's: it is a contraction of it is. Where as its is a word used to announce the thing that belongs to it. e.g its hat (the hat that belongs to it). – ctrl-alt-delor Jul 15 '14 at 22:44
  • @ctrl-alt-delor. I think it's more important to keep quotes balanced: don't you? – Paul_Pedant May 27 '20 at 8:03
  • @Paul_pedant In English an apostrophe is not a quote. Or are you saying that you should have even parity in your apostrophes? Like in your comment. – ctrl-alt-delor May 27 '20 at 17:08

According to your description, the name of each of these 108 files should follow the format style.size.color.ext.

So it should be

mkdir shirts
touch {tee,crew,turtleneck}.{XXL,XL,L,M,S,XS}.{red,yellow,blue}.{info,inv}

What touch is doing is creating an empty file, but you are trying to create a directory shirts with different subdirectories. touch can't do that.

Edit: You can also make the touch cmd above shorter / look better:

touch {tee,crew,turtleneck}.{{X,XX,}L,M,{X,}S}.{red,yellow,blue}.{info,inv}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.