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.

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter14: Files And Streams
Section: Chapter Questions
Problem 3E
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
CMPTR
CMPTR
Computer Science
ISBN:
9781337681872
Author:
PINARD
Publisher:
Cengage
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L