Sample Header Ad - 728x90

how to make a subset of commands be conditional?

0 votes
1 answer
147 views
I'm having issues finding a direct answer to my question, maybe because I don't know how to phrase it or the correct terms. I'm looking to find out how to make a subset of commands in a chain be "either or" as in
A && B && (C || D) && E && F
where the result of the previous command dictates if the next fires. In this case it's a chef command
knife vault create
that causes the issue with a break error when trying to create a vault that already exists. So I want to do
knife vault update
if knife vault create errors out of the script Heres a bigger overview
command1 && \
command2 && \
(knife vault create
or
knife vault update) && \
command4 && \
continuing...
As there are so few cases (1) so far in the script I'm making I wanted to keep the formatting instead of suddenly beginning with if/else or something "more advanced".
Asked by Sir_redan (3 rep)
Feb 19, 2020, 02:27 PM
Last activity: Feb 20, 2020, 07:58 AM