简体   繁体   中英

Error when creating Directory and creating files using touch in UNIX

I am trying to create a directory structure in Unix. I made the directory using mkdir command with -p option but when i use "touch" to create files i get hit with the "No such file or directory error" 层次结构

The code i tried .

mkdir -p livingthings{birds/{flyingbirds,nonflyingbirds},plants,animals/{mammals,reptiles}}
touch livingthings/{birds/{flyingbirds/{stork,eagle,eider},nonflyingbirds/{kiwi,ostrich,penguin}},plants/{carrot,cabbage,daisy},animals/{mammals/{jaguar,dog,tiger},reptiles/{alligator,skink,turtle}}}

This is the error which pops out错误

Help much appreciated.

UPDATE : After adding the "/" i get one error now that is telling

touch: cannot touch 'livingthings/animals/reptiles/turtle': No such file or directory .:     

The issue is you missed the slash after livingthings in mkdir -p livingthings/{birds..... not mkdir -p livingthings{birds.... Because of this it creates a directory named livingthingsbirds instead of livingthings/birds. But then in your touch command ur using livingthings/ so thats why it cant find that directory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM