1-With the active directory: $HOME/doc and HOME=/home/student, answer the questions about the following function: 1. Wha

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

1-With the active directory: $HOME/doc and HOME=/home/student, answer the questions about the following function: 1. Wha

Post by answerhappygod »

1-With the active directory: $HOME/doc and HOME=/home/student,
answer the questions about the following function:
1. What will be the output?
2. Change it to give the bash version of PS1 as well.
3. What if the commands (chdir and PS1) are swapped?
cdnew() { chdir ${ 1:-$HOME/Desktop} ; PS1=" ́pwd ́$ " ; export
PS1 ; }
2- #!/bin/bash
for outer in I II III IV V # outer loop
do
echo; echo -n "Group $outer: "
# ---------------------------------
#inner loop
for innerloop in 1 2 3 4 5 do
echo -n "$innerloop "
if [ "$innerloop" -eq 3 ] then break
fi
done
# --------------------------
done
echo; echo
exit 0
What would be the result under the following conditions in the
above SCRIPT? Please explain the reasons.
If we put 1.Continue
If we put 2.Continue 2
3-Explain the following SCRIPT output by describing each
element:
echo "Copying files, please wait\t\c"
for i in ${FILES} ; do cp $i $DEST && echo ".\c" ;
done
echo "\tDone."
Unix Programming
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply