-
Notifications
You must be signed in to change notification settings - Fork 27
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
Make it easier to run multiline script #558
Comments
Thanks for the suggestion @cowwoc! I can think of a few other workarounds for packaging a multiline script into a single command (bash functions, stuffing '; ' at the end of every line but the last, etc.) but I understand that it would be much nicer if you didn't any packaging like that. One challenge with just executing a multiline string right now is that Command is actually somewhat agnostic about the shell that it's running in. You could use bash, Tcsh, powershell, or something more obscure, but that means that we probably can't actually just run a multiline script since every shell would probably need a different approach to packaging it as a single command to run. What might be doable would be to run a list of commands in order (but as completely separate processes). That would require you to pass a list of strings rather than one multi line string, but would be easier than the cat into the file, then run the file approach you're using. It wouldn't be quite like running a script though, since you could not set variables in one line and then use them later in another. Another challenge with this approach would be deciding what to do when one of the commands fails; how to represent all the results in state, etc. Given all these challenges, I'm not sure this is something we could move on anytime soon, but I'd be very open to more suggestions about how we could make your use case better in light of all the nuance above! |
Maybe I'm missing something but... You already have Would this work? |
I don't think so; I can't run
I think the two options for general support that would be most reliable would be:
|
Hello!
Issue details
Please make it easier to run multiline scripts that are declared in a
string
variable. Currently, we need to do something like this:The text was updated successfully, but these errors were encountered: