Question: 1. Log into the Linux system as a normal user. 2. Launch a terminal emulator from the desktop environment's menu system if you used a

1. Log into the Linux system as a normal user.

2. Launch a terminal emulator from the desktop environment's menu system if you used a GUI login method.

3. Start an editor, and tell it to edit a file called testscript.sh.

4. Type the following lines into the editor:

#!/bin/bash

for file in $(ls *.txt)

do

echo -n "Display $file? "

read answer

if [ $answer == 'y' ]

then

less $file

fi

done

Make sure you've typed every character correctlyany mistake may cause the script to misbehave.

5. Save the file, and exit the editor.

6. Type chmod u+x testscript.sh to add the executable bit to the file's permissions.

7. Type ./testscript.sh to run the script. If there are no text (*.txt) files in your current directory, the script displays a no such file or directory error message, but if any text files are present, the script gives you the option of viewing each one in turn via less.

Need pictures of the output, I keep getting an error stating file not found. I have tried for over an hour.

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!