3 improved markdown
source | link

I use the &&&& and || techniques|| operators exclusively now instead of if...thenif;then. But sometimes it's just a lot clearer to go back to if...then`if;then'. This is one of those times since you require a commandline solution.

I would rewrite it like this...

$ if mycmd.sh; then { success; actions; } else { fail; actions; } fi;  rm -rf temp_files/

mycmd.sh runs and 'if' uses its result. The curly braces ensure that the list of multiple commands inside are handled as one block and they enhance the clarity. The spaces around the braces and semicolon after each command within, including the last, are mandatory. Since the 'rm' occurs after the 'fi;', it will execute unconditionally.

  • mycmd.sh runs and if uses its result
  • The curly braces ensure that the list of multiple commands inside are handled as one block and they enhance clarity. The spaces around the braces and semicolon after each command within, including the last, are mandatory.
  • Since the rm occurs after the fi, it will execute unconditionally.

I use the && and || techniques exclusively now instead of if...then. But sometimes it's just a lot clearer to go back to if...then. This is one of those times since you require a commandline solution.

I would rewrite it like this...

$ if mycmd.sh; then { success; actions; } else { fail; actions; } fi;  rm -rf temp_files/

mycmd.sh runs and 'if' uses its result. The curly braces ensure that the list of multiple commands inside are handled as one block and they enhance the clarity. The spaces around the braces and semicolon after each command within, including the last, are mandatory. Since the 'rm' occurs after the 'fi;', it will execute unconditionally.

I use the && and || operators exclusively now instead of if;then. But sometimes it's just a lot clearer to go back to `if;then'. This is one of those times since you require a commandline solution.

I would rewrite it like this...

$ if mycmd.sh; then { success; actions; } else { fail; actions; } fi;  rm -rf temp_files/
  • mycmd.sh runs and if uses its result
  • The curly braces ensure that the list of multiple commands inside are handled as one block and they enhance clarity. The spaces around the braces and semicolon after each command within, including the last, are mandatory.
  • Since the rm occurs after the fi, it will execute unconditionally.
2 completed answer after frozen cursor using the StackExchange Android app.
source | link

I use the && and || techniques exclusively now instead of if...then. But sometimes it's just a lot clearer to go back to if...then. This is one of those times since you require a commandline solution.

I would rewrite it like this...

$ if mycmd.sh; then { success; actions; } else { fail; actions; } fi;  rm -rf temp_files/

mycmd.sh runs and 'if' uses its result. The curly braces ensure that the list of multiple commands inside are handled as one block and they enhance the clarity. The spaces around the braces and semicolon after each command within, including the last, are mandatory. Since the 'rm' occurs after the 'fi;', it will execute unconditionally.

I use the && and || techniques exclusively now instead of if...then. But sometimes it's just a lot clearer to go back to if...then. This one of those times since you require a commandline solution.

I would rewrite it like this...

$ if mycmd.sh; then { success; actions; } else { fail; actions; } fi;  rm -rf temp_files/

mycmd.sh runs and 'if' uses its result

I use the && and || techniques exclusively now instead of if...then. But sometimes it's just a lot clearer to go back to if...then. This is one of those times since you require a commandline solution.

I would rewrite it like this...

$ if mycmd.sh; then { success; actions; } else { fail; actions; } fi;  rm -rf temp_files/

mycmd.sh runs and 'if' uses its result. The curly braces ensure that the list of multiple commands inside are handled as one block and they enhance the clarity. The spaces around the braces and semicolon after each command within, including the last, are mandatory. Since the 'rm' occurs after the 'fi;', it will execute unconditionally.

1
source | link

I use the && and || techniques exclusively now instead of if...then. But sometimes it's just a lot clearer to go back to if...then. This one of those times since you require a commandline solution.

I would rewrite it like this...

$ if mycmd.sh; then { success; actions; } else { fail; actions; } fi;  rm -rf temp_files/

mycmd.sh runs and 'if' uses its result