nerdexam
CompTIACompTIA

PT0-003 · Question #93

PT0-003 Question #93: Real Exam Question with Answer & Explanation

Sign in or unlock PT0-003 to reveal the answer and full explanation for question #93. The question stem and answer options stay visible for context.

Submitted by wei.xz· Mar 6, 2026Reconnaissance and Enumeration

Question

A penetration tester wants to use the following Bash script to identify active servers on a network: 1 network_addr="192.168.1" 2 for h in {1..254}; do 3 ping -c 1 -W 1 $network_addr.$h > /dev/null 4 if [ $? -eq 0 ]; then 5 echo "Host $h is up" 6 else 7 echo "Host $h is down" 8 fi 9 done Which of the following should the tester do to modify the script?

Options

  • AChange the condition on line 4.
  • BAdd 2>&1 at the end of line 3.
  • CUse seq on the loop on line 2.
  • DReplace $h with ${h} on line 3.

Unlock PT0-003 to see the answer

You've previewed enough free PT0-003 questions. Unlock PT0-003 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.

Topics

#Bash scripting#network scanning#scripting error
Full PT0-003 PracticeBrowse All PT0-003 Questions