Your Bash maintenance script is executed by a monitoring service that reads diagnostics from standard error. For one fault condition the script must output the text ERROR: Configuration file missing to standard errorwithout appending the normal trailing newline so the parent process can continue writing on the same line. Which single-line command accomplishes both tasks?
The -n option of echo suppresses the automatic trailing newline, and the redirection operator >&2 sends the command's standard-output stream to file descriptor 2 (stderr). Therefore, echo -n "ERROR: Configuration file missing" >&2 writes the required string, keeps the cursor on the same line, and delivers it on the correct stream.
The command echo "ERROR: Configuration file missing" 1>&2 correctly redirects to stderr but still appends a newline because it lacks the -n option.
The command echo -e "ERROR: Configuration file missing\c" 2>&1 uses the \c escape sequence to suppress the newline, but it incorrectly redirects standard error to standard output (2>&1), so the message is not sent to the required stream.
The command echo -E "ERROR: Configuration file missing" >&2 correctly redirects to stderr but also lacks the -n option, so it still appends a newline.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What does the `>&2` operator do in Bash?
Open an interactive chat with Bash
What is the purpose of the `-n` option in the echo command?
Open an interactive chat with Bash
What happens when you use `2>&1` in a Bash command?
Open an interactive chat with Bash
CompTIA Linux+ XK0-006 (V8)
System Management
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99
$19.99/mo
Billed monthly, Cancel any time.
3 Month Pass
$44.99
$14.99/mo
One time purchase of $44.99, Does not auto-renew.
MOST POPULAR
Annual Pass
$119.99
$9.99/mo
One time purchase of $119.99, Does not auto-renew.
BEST DEAL
Lifetime Pass
$189.99
One time purchase, Good for life.
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .