Question

To check if a file /tmp/data.txt is both readable and writable by the current user in a shell conditional, which test is correct?

A if [ -r /tmp/data.txt && -w /tmp/data.txt ]; then
B if [ -r /tmp/data.txt ] && [ -w /tmp/data.txt ]; then
C if test -rw /tmp/data.txt; then
D if [ -read /tmp/data.txt -write ]; then
E if [[ -r /tmp/data.txt -a -w /tmp/data.txt ]]; then
Practice Next

Hey! Ask a query