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
1-With the active directory: $HOME/doc and HOME=/home/student, answer the questions about the following function: 1. Wha
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am