Skip to content
Sven Nilsen edited this page Mar 19, 2014 · 1 revision

Bash allows grouping of commands into parenthesis.

This is very useful because '||' can be used to chain a block that executes if the previous fails.

Example:

test -e examples \
|| \
( \
    mkdir examples \
    && echo -e "fn main() {\n\tprintln!(\"Hello!\");\n}\n" > examples/hello.rs \
    && clear \
    && echo "--- Created examples folder" \
)
Clone this wiki locally