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

🎓
Think You're Ready for RBI Grade B?
RBI Grade B 2026 Phase 1 Memory Based Paper
  • 200 Questions with Detailed Solutions
  • Section-wise Coverage (GA, English, Quant & Reasoning)