3 ms·
Semicolon works, though doesn't have the quit/shortcutting on exit code semantics. There are some community tools to fake it a little better (Get-ExitBoolean).
by WorldMaker 9y ago
Semicolon works, though doesn't have the quit/shortcutting on exit code semantics.
There are some community tools to fake it a little better (Get-ExitBoolean).
Also, a big GitHub issue tracking it: https://github.com/PowerShell/PowerShell/issues/3241 https://github.com/PowerShell/PowerShell/issues/3241
- darrenf 9y ago> Semicolon works, though doesn't have the quit/shortcutting on exit code semantics. I would say it's a little more than semantics. Consider cd /some/dir/with/a/typo && some_destructive_cmd . vs the semi-colon equivalent.
- WorldMaker 9y agoNo, absolutely, there are many cases where semicolon is a bad replacement and a more suitable arrangement found. I'm just speaking to a lot of the "quick one line scripts" that aren't dangerous, such at the parent suggested. Things like `npm install && npm prune` are fine as `npm install; npm prune`. It may "waste" cycles in the rare case of a failed install, but it isn't dangerous. I agree though, a good short-circuiting Boolean operator would be nice.