Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Brace expansion #1

Closed
kashav opened this issue Jan 14, 2017 · 2 comments
Closed

Brace expansion #1

kashav opened this issue Jan 14, 2017 · 2 comments

Comments

@kashav
Copy link
Member

kashav commented Jan 14, 2017

For some reason, brace expansion isn't working with exec.Command. Right now, I'm just printing the mkdir and touch commands, so they can still be copied/pasted and run, but it'd be definitely huge to get this working so we can just build the full directory without having to run any extra commands manually.

What's happening is that the script is interpreting the brackets as strings, so it's creating directories with braces in the names, rather than using the braces to determine structure.

@mholt
Copy link

mholt commented Jan 15, 2017

For some reason, brace expansion isn't working with exec.Command

I'm pretty sure exec.Command doesn't do any interpretation of the arguments; you'll have to do the expansion manually.

kashav added a commit that referenced this issue Jan 15, 2017
Remove mkdir -p in favor of os.MkdirAll
kashav added a commit that referenced this issue Jan 15, 2017
@kashav
Copy link
Member Author

kashav commented Jan 15, 2017

@mholt Hey - thanks for the tip! I wonder if the following would work then 🤔 --

exec.Command("mkdir", "-p", "foo/", "{", "bar", ",", "baz", "}")

Anyways, ended up building a list of all paths and using os.MkdirAll / os.Create to do this (b0967e9) - thanks again!

Edit: never mind, that doesn't work, I really don't know why I thought it would. 😅

@kashav kashav closed this as completed Jan 15, 2017
kashav added a commit that referenced this issue Jan 15, 2017
Wording, remove #1 note, change config -> template
kashav added a commit that referenced this issue Jan 15, 2017
Wording, remove #1 note, change config -> template
kashav added a commit that referenced this issue Jan 15, 2017
Wording, remove #1 note, change config -> template
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants