A UNIX administrator is preparing a post-provisioning script. A text file called users.txt (one login name per line) is generated by upstream tooling. For every listed user the script must copy the default Bash configuration from /etc/skel/.bashrc so that each person gets their own file, e.g., /home/alice/.bashrc, /home/bob/.bashrc, and so forth. The administrator decides to feed users.txt to xargs rather than write an explicit loop. Which xargs command correctly substitutes each username into the destination path so that one cp command runs per user and the placeholder is replaced instead of left literally in the argument list?
The -I option tells xargs to treat as a placeholder and substitute it with each line from users.txt. Without -I, xargs simply appends arguments to the end or splits lines without recognizing the placeholder, so would remain literal or misalign arguments. Options that only limit arguments per invocation (-n1, -L1) do not perform placeholder replacement.
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 -I {} option in xargs do?
Open an interactive chat with Bash
How does xargs differ when using -n1 or -L1 compared to -I {}?
Open an interactive chat with Bash
Why would -I {} be necessary for copying files in this scenario?