From 847f98ab19bedf83a2cf06640901370f2c78f3b6 Mon Sep 17 00:00:00 2001 From: Jyoti Narang Date: Wed, 21 Aug 2024 11:19:12 -0400 Subject: [PATCH] Shell assignment changes added in assignment.sh --- 02_activities/assignments/assignment.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) mode change 100644 => 100755 02_activities/assignments/assignment.sh diff --git a/02_activities/assignments/assignment.sh b/02_activities/assignments/assignment.sh old mode 100644 new mode 100755 index 27d7034b..e678105e --- a/02_activities/assignments/assignment.sh +++ b/02_activities/assignments/assignment.sh @@ -8,17 +8,20 @@ set -x # > Add your code below each comment to complete the tasks # 1. Create 5 directories named dir1, dir2, dir3, dir4, and dir5 - + mkdir dir{1..5} # 2. List the contents of the parent directory to verify the presence of the 5 directories - + ls # 3. Create 5 text files in dir2 named file1, file2, file3, file4, and file5 - + for f in file{1..5}; do touch dir2/$f; done # 4. Append the words "Hello world" to dir2/file3 - + echo "Hello world" >> dir2/file3 # 5. Verify that file3 contains the words "hello world" by printing the contents of the file in the terminal - + cat dir2/file3 # 6. Delete file4 - + rm dir2/file4 # 7. Delete directories dir4 and dir5 including all their contents (if any) - + for dir in dir{4..5}; + do rm -r "$dir" + done # 8. List the contents of the parent directory to verify the deletion of dir4 and dir5 + ls \ No newline at end of file