Linux Shell Scripting Print all lines that end with the word test. File name is
ID: 3781407 • Letter: L
Question
Linux Shell Scripting
Print all lines that end with the word test. File name is file1.
Write the commands to place number 5 in variable x and then subtract 2 from it.
Write a script to read two numbers into variables called x and y. Display which number is greater and which number is smaller. If the numbers are equal display that the two numbers are equal.
Write a script to get the name, email, phone number of several students. Save these results in a file called info. Also ask the user to see if the loop should be continued or not. At the end display the file sorted based on the name of the students.
Explanation / Answer
sed -n '/test$/ { s///; :a; n; p; ba; }' file1 #!/bin/sh X=5 X=$(X-2) #!/bin/sh Enter value of X read X Enter value of Y read Y if [ $X == $Y] then echo "X and Y are equal" elif [$X -gt $Y ] echo "X is greater than Y" elif [ $a -lt $b ] echo "Y is less than X" fi
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.