Question: Using Linux Bas Exercise 3: (Troubleshooting Bash Scripts) Syntax and Logical Errors are integrated in the following bash scripts. Fix the Errors or Rewrite the

Using Linux Bas

Exercise 3: (Troubleshooting Bash Scripts) Syntax and Logical Errors are integrated in the following bash scripts. Fix the Errors or Rewrite the script to accomplish the task.

Task 3.1: When given an input file, script will read the lines of the file and execute them in sequence.

#/bin/bash mkir test

cd tst

echo this is file1" > file1

sed 's/1/2/` < file1 > file2

cat > file3 << EOF

this is file3

EOF

cdc..

lst test > filelist

Task 3.2: Using Read Command (Delete a file that exist on your system)

!/bin/bash echo Please enter the name of the file to delete:

readline delfiles

rmove $defile

echo $delfile Deleted

Task 3.3: Add users (Log on as root)

#!/bin/bash/

# The mkuser script was written by Dhillon

# to make my life a little easier.

# echo "This program will add a new user."

echo "Type exit to quit."

echo -nn "Enter a new username: "

read name

while [ $names != "exit" ]; does

userad -d /home/$name -s /bin/bash $name

passwordd $name

echo -n " Type exit to quit or Enter a new username: "

read naeme

do exit

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!