Do you want BuboFlash to help you learning these things? Or do you want to add or correct something? Click here to log in or create user.



Question

In linux, write one-line script to spit out content of file kevin.txt to stdout ONLY if kevin.txt file exists. Do it by finishing following code snippet:

ls kevin.txt > /dev/null [...]

Answer

&& cat kevin.txt

^^ note use of && to indicate only if command 1 (i.e. ls kevin.txt > /dev/null) succeeds, then run command 2 (i.e. cat kevin.txt)


Question

In linux, write one-line script to spit out content of file kevin.txt to stdout ONLY if kevin.txt file exists. Do it by finishing following code snippet:

ls kevin.txt > /dev/null [...]

Answer
?

Question

In linux, write one-line script to spit out content of file kevin.txt to stdout ONLY if kevin.txt file exists. Do it by finishing following code snippet:

ls kevin.txt > /dev/null [...]

Answer

&& cat kevin.txt

^^ note use of && to indicate only if command 1 (i.e. ls kevin.txt > /dev/null) succeeds, then run command 2 (i.e. cat kevin.txt)

If you want to change selection, open document below and click on "Move attachment"

20. Advanced Shell Scripting
tc/passwd file, causing useradd to be executed. An alternate representation is grep -v '^harry:' /etc/passwd && useradd harry where the -v option inverts the sense of matching of grep . <span>&& has the opposite meaning to || , that is, to execute the second command only if the first succeeds. Adept script writers often string together many commands to create the most succinct

Summary

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Details

No repetitions


Discussion

Do you want to join discussion? Click here to log in or create user.