# <NL> in a cmd output are substituted with spaces for a comfort.
#
#
###############################
#! BASIC EXEC #################
###############################
#
#--------------------------
echo a
a
#--------------------------
echo a; echo b
a b
#--------------------------
cat shouldnotexist
cat: shouldnotexist: No such file or directory
#--------------------------
#
#
###############################
#! CONDITIONAL OPERATORS ######
###############################
#
#--------------------------
echo a && echo b
a b
#--------------------------
echo a && echo b && echo c
a b c
#--------------------------
cat shouldnotexist && echo b
cat: shouldnotexist: No such file or directory
#--------------------------
echo a && cat shouldnotexist
a cat: shouldnotexist: No such file or directory
#--------------------------
echo a || echo b
a
#--------------------------
echo a || echo b || echo c
a
#--------------------------
cat shouldnotexist || echo b
cat: shouldnotexist: No such file or directory b
#--------------------------
echo a || cat shouldnotexist
a
#--------------------------
echo a || echo b && echo c
a c
#--------------------------
echo a || echo b && echo c || echo d
a c
#--------------------------
echo a && echo b || echo c && echo d
a b d
#--------------------------
#
#
###############################
#! ARROW REDIRECTIONS #########
###############################
#
#-------------------------- File creation with '>'
> /tmp/.delme; cat /tmp/.delme; rm /tmp/.delme

#-------------------------- Just should work
< /

#-------------------------- Redirect output
echo y > /tmp/.delme; cat /tmp/.delme; rm /tmp/.delme
y
#-------------------------- Redirect input ; Redirect output
echo y > /tmp/.delme; cat < /tmp/.delme; rm /tmp/.delme
y
#-------------------------- Redirect input and output simultaneously
echo y > /tmp/.f1; cat < /tmp/.f1 > /tmp/.f2; \
    cat /tmp/.f1 /tmp/.f2; rm /tmp/.f1 /tmp/.f2
y y
#-------------------------- Appending redirection
echo y>/tmp/.f1 && echo y>>/tmp/.f1; cat /tmp/.f1; rm /tmp/.f1
y y
#-------------------------- Check if the '>>' redir works properly
echo y>>/tmp/.f1>>/tmp/.f2>>/tmp/.f3; \
    head -v -n -0 /tmp/.f1 /tmp/.f2 /tmp/.f3; \
        rm /tmp/.f1 /tmp/.f2 /tmp/.f3
==> /tmp/.f1 <==  ==> /tmp/.f2 <==  ==> /tmp/.f3 <== y
