Page 1 of 1

( I need 100% right solution. please use Linux Ubunto and then send me screenshot step by step. i say again need right s

Posted: Thu May 26, 2022 9:59 am
by answerhappygod
( I need 100% right solution. please use Linux Ubunto and then send me screenshot step by step. i say again need right solution. please use Linux Ubunto.)
…...…............................................................
Project 2 Shell programming
2 Steps
2.1 vi
Step 1:Login the Linux as user stu.
Step 2:Start vi and switch to insert mode, enter the following words:
This is an exercise!
We use vi to do the edit.
Left, down, up, right.
Step 3:Search pattern in this file. Write the command and the result.
Step 4:Substitute one string. Write the command and the result.
Step 5:Copy/cut and paste some lines in the file. Write the command and the result.
Step 6:Copy/cut and paste some words in the file. Write the command and the result.
Step 7:How to repeat the last command or undo the last command.
Step 8:Write the command of how to quit or write and quit.
2.2 Shell programming
Step 1:Use vi to input Codes List 2-1.
Step 2:Run the program. If it cannot be executed, try to analyze the reason and fix it.
Step 3:Record the result of this program.
Step 4:Read the code, complete the function file_run().
Step 5:Modify function uers(), so as to display online users without breaking lines.
3 Summary
4 Codes List
#2-1 menu
MYDATE=`date +%d/%m/%y`
THIS_HOST=`hostname -s`
USER=`whoami`
file_run()
{
echo "you must complete it"
}
uers()
{
echo "there are `who|wc -l` users online"
echo -e "who are\n`who|awk '{print $1}'`"
}
while :
do
tput clear
cat <<aaa
---------------------------------------------------------------------
User:$USERHost:$THIS_HOSTDate:$MYDATE
---------------------------------------------------------------------
1 : List subdirectory in current directory
2 : List files in current directory which can run
3 : See who is on the system
H : Help screen
Q : Exit Menu
--------------------------------------------------------------------
aaa
echo -e -n "\tYour Choice [1,2,3,H,Q] >"
read CHOICE
case $CHOICE in
1) ls -l|awk '/^d/ {print $8}'
;;
2) file_run
;;
3) uers
;;
H|h)
cat <<aaa
This is the help screen,nothing here yet to help you!
aaa
;;
Q|q) exit 0
;;
*) echo -e "\t\007 unkown user response"
;;
esac
echo -e -n "\n\n\tHit the return key to continue"
read DUMMY
done