0

It's possible to create this file structure with one line of code in bash?

├── assets
│   ├── css
│   │   └── index.css
│   ├── js
│   │   └── index.js
│   └── images

2 Answers 2

2
mkdir -p assets/{css,js,images}; touch assets/{css/index.css,js/index.js}
Sign up to request clarification or add additional context in comments.

Comments

0

Other option with install:

$ tree
.
0 directories, 0 files

$ for i in assets/{{css/index.css,js/index.js},images}; do
  [[ $i == "assets/images" ]] && (install -d "$i"||:) || install -D /dev/null "$i"
done

$ tree
.
└── assets
    ├── css
    │   └── index.css
    ├── images
    └── js
        └── index.js

4 directories, 2 files

one line:

for i in assets/{{css/index.css,js/index.js},images}; do   [[ $i == "assets/images" ]] && (install -d "$i"||:) || install -D /dev/null "$i"; done

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.