4. List the size and path of all files in the working directory non-recursively using find. 5. List the path of files with the extension "txt" in the home directory.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

shell scripting

only task 2 number 4 , 5 

Task I (for January 12)
1. In your home directory somewhere on your home directory (either on macOS or Linux), create a directory named breakfast
2. Change to the breakfast folder.
3. Create two empty files, file1.txt and file2.txt.
4. Randomly copy three more files into this folder, text file or not. (If you need text files, copy them from http://www.textfiles.com/directory.html )
5. Create a directory named messy
6. Create an empty file file3.txt.
7. Add a few lines of text to this file. (If you don't feel like searching, use http://www.textfiles.com/humor/COMPUTER/aliceunix.txt just for fun.)
8. Randomly copy two more files into this folder.
Task II (for January 17)
Change to the breakfast folder.
Then complete the following tasks by writing shell commands at the prompt:
1. Check if a file exists. Print a message stating if the file exists or not.
2. Read from a given text file and print the content on the screen with one blank line after each line in the file (like double-spacing the content). Make sure your script checks if the file
exists before the actual operation. If not, report the error. Test this script with messy/file3.txt.
3. List the path of all files (no directory) in the working directory non-recursively using a for loop (without using Is or find).
4. List the size and path of all files in the working directory non-recursively using find.
5. List the path of files with the extension "txt" in the home directory.
Transcribed Image Text:Task I (for January 12) 1. In your home directory somewhere on your home directory (either on macOS or Linux), create a directory named breakfast 2. Change to the breakfast folder. 3. Create two empty files, file1.txt and file2.txt. 4. Randomly copy three more files into this folder, text file or not. (If you need text files, copy them from http://www.textfiles.com/directory.html ) 5. Create a directory named messy 6. Create an empty file file3.txt. 7. Add a few lines of text to this file. (If you don't feel like searching, use http://www.textfiles.com/humor/COMPUTER/aliceunix.txt just for fun.) 8. Randomly copy two more files into this folder. Task II (for January 17) Change to the breakfast folder. Then complete the following tasks by writing shell commands at the prompt: 1. Check if a file exists. Print a message stating if the file exists or not. 2. Read from a given text file and print the content on the screen with one blank line after each line in the file (like double-spacing the content). Make sure your script checks if the file exists before the actual operation. If not, report the error. Test this script with messy/file3.txt. 3. List the path of all files (no directory) in the working directory non-recursively using a for loop (without using Is or find). 4. List the size and path of all files in the working directory non-recursively using find. 5. List the path of files with the extension "txt" in the home directory.
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Linux
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education