Run complete
59%
20 / 34 scored
Pick one to go back and answer it in this run.
read command that stores password input into variable PASSWORD WITHOUT echoing the typed characters to the screen.if construct that sends a "Maintenance Error" mail to root ONLY if the immediately preceding command failed.test/[Which command starts an interactive non-login shell as root, assuming the caller already has sudo rights?
Your answerB
Correct answerC
sudo -s (also sudo su, sudo su root, or sudo -u root -s) starts a non-login shell as root. sudo -i, sudo su - and sudo su - root all start login shells instead.
Where should a function be defined so it is available to
| Started | Score | % | Change |
|---|---|---|---|
| 6 Sept 2026, 06:36 (current run) | 20 / 34 | 59% | — |
$FROM$TOYour answerA
Correct answerC
/etc/bash.bashrc is read by all interactive shells system-wide, login or not; ~/.bashrc only covers one user's non-login shells, and /etc/profile only covers login shells.
Assuming PATH currently holds /usr/bin:/bin, write the assignment that appends /home/carol/scripts to the END of PATH.
Your answerno answer recorded
Correct answer`PATH=$PATH:/home/carol/scripts`
PATH=$PATH:/home/carol/scripts — appending to the end means it's searched last; prepending (PATH=/home/carol/scripts:$PATH) makes it searched first.
Complete this snippet for ~/.profile so that ~/bin is only added to PATH when the directory actually exists: if [ -d "$HOME/bin" ] ; then ____ ; fi
Your answerno answer recorded
Correct answer`PATH="$HOME/bin:$PATH"`
PATH="$HOME/bin:$PATH" — guarding the PATH edit with a -d test avoids blindly prepending a directory that isn't there.
Using let, write the single command that creates local variable my_val holding the result of 5 + 5.
Your answerno answer recorded
Correct answer`let "my_val = 5 + 5"`
let "my_val = 5 + 5" (single quotes work identically).
A function named my_fun is defined in the current shell. Type the command that removes it.
Your answerno answer recorded
Correct answer`unset -f my_fun`
unset -f my_fun — the -f flag targets functions specifically, since plain unset would instead look for a variable named my_fun.
Script do.sh is executable; undo.sh is a symlink pointing to it. From inside the script, which special variable reveals whether it was invoked as do.sh or undo.sh?
Your answerD
Correct answerA
$0 holds the name used to invoke the script (the symlink name, not the target's real name).
Which pair of startup files does an interactive login Bash shell read that an interactive non-login shell does not?
Your answerA
Correct answerB
login shells additionally read /etc/profile then ~/.profile (or ~/.bash_profile/~/.bash_login if present). Both login and non-login interactive shells read /etc/bash.bashrc and ~/.bashrc.