Question
1. Do the exercise on bash and show a screen dump for the following questions. A. How to Define variable x with value 10 and
1. Do the exercise on bash and show a screen dump for the following questions.
A. How to Define variable x with value 10 and print it on screen.
B. How to Define variable xn with value John and print it on screen
C. In order to print the sum of two numbers, say 6 and 3 someone wrote this line $ echo 6 + 3 Try it and if you do not get the correct value, fix it to get the value as 9
D. Write a bash script to define two variable x=20, y=5 and then to print division of x and y (i.e. x/y) (NOTE YOU MUST SHOW THE WHOLE SCRIPT AS PART OF THE ANSWER)
E. Modify the script in you wrote in d to assign the x/y value to another variable z and print z. (NOTE YOU MUST SHOW THE WHOLE SCRIPT AS PART OF THE ANSWER)
F. An exercise was given to student to print the following on the screen. The student wrote the following script. But the result was not coming out right.
What errors has the student make? (Circle the error and do the correction)
#!/bin/bash
# Script to test MY knowledge about variables!
# myname=Peacock
myos = TroubleOS
myno=5 e
cho "My name is $myname"
echo "My os is $myos"
echo "My number is myno, can you see this number"
G. What are the 3 standard streams in Unix/Linux? (No screen dump needed)
H. 1. Open any editor and create a test.txt file and type in hello world in the file and save it. 2. Write a bash command to count the number of characters in the test.txt file.
I. 1. On the command line type the following (with the > symbol) ls -1 > a.lst 2. Now do an ls command and explain what you see. j. Write the bash command that will copy the file myfile.txt to the directory called samples.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started