Consider the following commands:
What is displayed when this sequence of commands is executed using the bash shell?
A.
Hello, world
B.
cat: cannot open file1: No such file or directory Hello, world
C.
cat: cannot open file1: No such file or directory
D.
bash: syntax error near unexpected token ‘| |’
E.
bash: syntax error broker pipe
Explanation:
Reference: Bash Reference Manual, Lists of Commands
# rm ./file1
rm: ./file1: No such file or directory
# echo “Hello, world” > ./file2
# cat ./file1 || ./file2
cat: cannot open ./file1: No such file or directory
-bash: ./file2: Permission denied
#
Answer: C
# cat ./file1 || ./file2 is not correct
Сarefully read the question
just try… B is correct
# cat ./file1 || ./file2
missing cat on ./file2
suppose to be # cat ./file1 || cat ./file2
B is correct answer
B is correct answer
Traid on virtual machine with Solaris 11
~/tmp# rm file1
~/tmp# echo “Hello, World” > file2
~/tmp# cat file1 || cat file2
cat: cannot open file1: No such file or directory
Hello, World
~/tmp#
B is correct answer
Test on VM soloaris 11
root@solaris11 #touch file1
root@solaris11 #touch file2
root@solaris11 #rm file1
root@solaris11 #echo “Hello, world” >file2
root@solaris11 #cat file1 ||cat file2
cat: cannot open file1: No such file or directory
Hello, World
root@solaris11 #