Sample Header Ad - 728x90

How can I use parameter expansion together with command substitution?

0 votes
4 answers
239 views
- I want to create 12 directories named after the months. So I tried using locale to get the month names, piping to tr to separate them with commas, then put braces around and passed to mkdir. But the whole is treated as one string. Is there a way to avoid this?
16:07: temp ⧲ mkdir {$(locale mon | tr \; ,)}

16:18: temp ⧲ ls -lh
total 4.0K
drwxr-xr-x. 2 john john 4.0K Dec 11 16:18 {January,February,March,April,May,June,July,August,September,October,November,December}

16:18: temp ⧲
Asked by teraspora (111 rep)
Dec 11, 2023, 04:20 PM
Last activity: Dec 11, 2023, 10:16 PM