Question
Basic bash /plz explain the step so i can understand thank yo Goals The purpose of this lab is to help you to get familiar
Basic bash /plz explain the step so i can understand thank yo
Goals
The purpose of this lab is to help you to get familiar with Unix in the following aspects:
- Create a bash file and run it.
- Learn about positional parameters.
Q1. Create a folder called lab2.
Q2. Create a bash file that is called (bashFile.sh) (20 points)
#! / bin /bash
echo "Hello World!
Run the bash file with the command bash bashFile.sh.
3. Test positional parameters
#! / bin /bash
echo "Positional Parameters"
echo ' $0 = ' $0
echo ' $1 = ' $1
echo ' $2 = ' $2
echo ' $3 = ' $3
positionalParameters.sh
Q4. Self-reproducing Script (20 points)
Write a script that backs itself up, that is, copies itself to a file named backup.sh.
Hint: Use the cat command and the appropriate positional parameter.
Q5. Backwards Listing (20 points)
Write a script that echoes itself to stdout, but backwards.
Q6. Changing the line spacing of a text file (40 points)
Write a script that reads each line of a target file, then writes the line back to stdout, but with an extra blank line following. This has the effect of double-spacing the file.
Include all necessary code to check whether the script gets the necessary command-line argument (a filename), and whether the specified file exists.
When the script runs correctly, modify it to triple-space the target file.
Finally, write a script to remove all blank lines from the target file, single-spacing it.
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