Answered step by step
Verified Expert Solution
Question
1 Approved Answer
in linux not use this command type d -empty find . type d -empty the file passwd is u1142478:x:502:66:Sondos_Awashra:/home/students/comp311/u1142478:/bin/csh u1150129:x:503:66:Mohammad_Kahala:/home/students/comp311/u1150129:/bin/bash u1150279:x:504:66:Tareq_Qahoush:/home/students/comp311/u1150279:/bin/bash u1150312:x:505:66:Ahmad_Thabet:/home/students/comp311/u1150312:/bin/bash u1150357:x:506:66:Mohammad_Alqayem:/home/students/comp311/u1150357:/bin/bash u1150409:x:507:66:Ahmad_Jamal:/home/students/comp311/u1150409:/bin/bash u1150523:x:508:66:Tarik_Suid:/home/students/comp311/u1150523:/bin/bash
in linux
not use this command type d -empty find . type d -empty
the file passwd is
u1142478:x:502:66:Sondos_Awashra:/home/students/comp311/u1142478:/bin/csh u1150129:x:503:66:Mohammad_Kahala:/home/students/comp311/u1150129:/bin/bash u1150279:x:504:66:Tareq_Qahoush:/home/students/comp311/u1150279:/bin/bash u1150312:x:505:66:Ahmad_Thabet:/home/students/comp311/u1150312:/bin/bash u1150357:x:506:66:Mohammad_Alqayem:/home/students/comp311/u1150357:/bin/bash u1150409:x:507:66:Ahmad_Jamal:/home/students/comp311/u1150409:/bin/bash u1150523:x:508:66:Tarik_Suid:/home/students/comp311/u1150523:/bin/bash u1152270:x:509:66:Atheer_Mohammad:/home/students/comp311/u1152270:/bin/zsh u1152484:x:510:66:Mohammad_Asad:/home/students/comp311/u1152484:/bin/bash u1152679:x:511:66:Haneen_Ashkar:/home/students/comp311/u1152679:/bin/csh u1153026:x:512:66:Noor_Abuhijleh:/home/students/comp311/u1153026:/bin/bash u1161333:x:576:66:Roa'A_Injass:/home/students/comp311/u1161333:/bin/bash u1161564:x:577:66:Abdallah_Zyoud:/home/students/comp322/u1161564:/bin/bash u1162505:x:579:66:Mohammed_Issa:/home/students/comp311/u1162505:/bin/bash u1163149:x:580:66:Ibraheem_Issa:/home/students/comp311/u1163149:/bin/bash u1111308:x:581:66:Saeed_Sabah:/home/students/comp311/u1111308:/bin/bash u1160305:x:513:66:Rebhiya_Sbeih:/home/students/comp311/u1160305:/bin/bash u1160440:x:514:66:Marah_Hamad:/home/students/comp311/u1160440:/bin/bash u1160455:x:515:66:Ahmad_Basheer:/home/students/comp311/u1160455:/bin/bash u1160481:x:516:66:Suhaib_AbuGhannam:/home/students/comp311/u1160481:/bin/bash u1161357:x:517:66:Bara_Ibrahim:/home/students/comp311/u1161357:/bin/bash u1161405:x:518:66:Rawan_Alimi:/home/students/comp311/u1161405:/bin/ksh u1162147:x:519:66:Nada_Zalloum:/home/students/comp311/u1162147:/bin/csh u1162422:x:520:66:Reem_Shamasnah:/home/students/comp311/u1162422:/bin/bash u1130212:x:521:66:Ibrahim_Njoum:/home/students/comp311/u1130212:/bin/bash u1131589:x:522:66:Yara_Hussien:/home/students/comp311/u1131589:/bin/ksh u1162074:x:535:66:Sabry_Alawy:/home/students/comp311/u1162074:/bin/bash u1162213:x:536:66:Noor_Hmeidan:/home/students/comp311/u1162213:/bin/bash u1162230:x:537:66:Jehad_AlMutan:/home/students/comp311/u1162230:/bin/bash u1162309:x:538:66:Hammam_Hamad:/home/students/comp311/u1162309:/bin/bash u1162314:x:539:66:Samer_Almasloot:/home/students/comp311/u1162314:/bin/bash u1163095:x:540:66:AbdelRahim_Ahmad:/home/students/comp311/u1163095:/bin/bash u1153160:x:541:66:Muayed_Mafarjeh:/home/students/comp311/u1153160:/bin/ksh u1143191:x:542:66:Alaa_Zubaidi:/home/students/comp311/u1143191:/bin/bash u1160766:x:543:66:Ahmad_Ghannam:/home/students/comp311/u1160766:/bin/bash u1152185:x:544:66:Mahmoud_AbdelKader:/home/students/comp311/u1152185:/bin/bash u1162651:x:545:66:Aya_Khateeb:/home/students/comp311/u1162651:/bin/bash u1151283:x:546:66:Mustafa_Salah:/home/students/comp311/u1151283:/bin/ksh u1141480:x:547:66:Ahmad_Qasem:/home/students/comp311/u1141480:/bin/bash u1141648:x:548:66:Mohammad_Mohammad:/home/students/comp311/u1141648:/bin/bash u1141879:x:549:66:Rawan_Khalaf:/home/students/comp311/u1141879:/bin/bash u1142011:x:550:66:Mohammad_Fitiani:/home/students/comp311/u1142011:/bin/bash u1142608:x:551:66:Haitham_Idrees:/home/students/comp311/u1142608:/bin/bash u1142651:x:552:66:Dalal_Fukheda:/home/students/comp322/u1142651:/bin/bash u1152329:x:553:66:Ibrahim_Rifaie:/home/students/comp311/u1152329:/bin/bash u1152477:x:554:66:Rami_Salman:/home/students/comp311/u1152477:/bin/ksh u1153214:x:555:66:Fahd_Hammouda,u1151429:/home/students/comp311/u1153214:/bin/bash u1153274:x:556:66:fares_whdan:/home/students/comp311/u1153274:/bin/bash u1153279:x:557:66:Yazeed_Nofal:/home/students/comp311/u1153279:/bin/bash u1160063:x:558:66:Ayah_Sa'Fin:/home/students/comp311/u1160063:/bin/bash u1160343:x:559:66:Mousa_Mtera:/home/students/comp322/u1160343:/bin/bash u1160394:x:560:66:Laith_Al-Budeiri:/home/students/comp311/u1160394:/bin/bash u1161196:x:561:66:Jeries_Nasrawi:/home/students/comp311/u1161196:/bin/bash u1161721:x:562:66:Mohammad_Dar-Ahmad:/home/students/comp311/u1161721:/bin/bash u1162344:x:563:66:Tawfiq_Abdulraziq:/home/students/comp311/u1162344:/bin/bash u1162949:x:564:66:Basil_Al-Sa`Ed:/home/students/comp311/u1162949:/bin/sh u1162955:x:565:66:Nader_AlBarghouthi:/home/students/comp311/u1162955:/bin/sh u1140360:x:566:66:Rawan_Safi:/home/students/comp311/u1140360:/bin/bash u1141936:x:567:66:Areej_Rimawi:/home/students/comp311/u1141936:/bin/sh u1142984:x:568:66:Ahlam_Ghazawneh:/home/students/comp311/u1142984:/bin/bash u1150845:x:569:66:Haneen_Taweel:/home/students/comp311/u1150845:/bin/bash u1151429:x:570:66:Amer_Aldaghamin:/home/students/comp311/u1151429:/bin/bash u1151432:x:571:66:Yanal_Abdeljawwad:/home/students/comp311/u1151432:/bin/bash u1160034:x:572:66:Taqwa_AbuAsbah:/home/students/comp311/u1160034:/bin/bash u1150383:x:523:66:Rami_Yahya:/home/students/comp311/u1150383:/bin/bash u1151913:x:524:66:Ahmad_Salah:/home/students/comp311/u1151913:/bin/bash u1153216:x:525:66:Isra_Hamed:/home/students/comp311/u1153216:/bin/bash u1150383:x:523:66:Rami_Yahya:/home/students/comp311/u1150383:/bin/csh u1151913:x:524:66:Ahmad_Salah:/home/students/comp311/u1151913:/bin/bash u1153216:x:525:66:Isra_Hamed:/home/students/comp322/u1153216:/bin/bash u1160076:x:526:66:Adnan_Assali:/home/students/comp322/u1160076:/bin/bash u1160155:x:527:66:Hani_Yaaqbeh:/home/students/comp311/u1160155:/bin/sh u1160170:x:528:66:Shadi_Mohammad:/home/students/comp311/u1160170:/bin/bash u1160643:x:529:66:Fatima_Ayyash:/home/students/comp311/u1160643:/bin/bash u1160658:x:530:66:Kamaleddin_Shaer:/home/students/comp311/u1160658:/bin/bash u1160707:x:531:66:Malak_Shoubi:/home/students/comp322/u1160707:/bin/bash u1161044:x:532:66:Fida_Zohour:/home/students/comp311/u1161044:/bin/bash u1161390:x:533:66:Noor_Kharoubi:/home/students/comp311/u1161390:/bin/bash u1161444:x:534:66:Salah_Suliman:/home/students/comp322/u1161444:/bin/bash u1152901:x:582:66:Darin_Jojas:/home/students/comp322/u1152901:/bin/bash(Your script should work on your own created files and directories if they are needed) Welcome Message Write a shell script that prints a welcome message when the user logs in. It should display the message "Good morning/Good afternoon/Good evening", depending on the time the user logs in. When the myprocessing script is running, the welcome script displays the message automatically that display the following Menu, as shown in figure 1 : Good afternoon Muard Njoum Please Choose one of the following options: Directories: 1) Create a Directory for All users 2) Change Permission for All Directory. 3) Print all empty directories. Files 4) Change Permission for All Files 5) Compare files 6) Delete Duplicated files Report: 7) Count and display all files that contain the same word. 8) Count the number of files that have the same name inside different directories. 9) Print all empty files. Exit Clarification of ALL Scripts 1. Directories: a) Create a Directory for All users Given the prj3.passwd file (attached to the project), write a shell script mkdirAll that will create a default directory inside the student's home directory (The student directory will be created inside your home directory). The script should create a default directory with a name as the following rule: concatenate the usemame's first letter with the full last name (i.e., If the usemame is Ahmad_Hamdan, then the created directory will be ahamdan). There is no argument, so the script should work even if the user adds an argument. Given the following line: u1202901:x:582:66:Ahmad_Hamdan:/home/students/comp322/u1202901:/bin/bash Sample: After running this script mkdirAll, the output will be as the following example: /mkdirall Proj.3_1200123_sec/home/students/comp322/u1202901/ahamdan Note: The home path (the one underlined in the above sample) is read from prj3.passwd file. b) Change Permission for All Directory. Write a shell script chmodAllDirectories, that will change the permission of all directories inside a given leading directory. The command chmodAllDirectories newpermission maindirecroty should set a new permission to all directories inside a given leading directory. The script should set a new permission for all "directories" inside the given directory. If there is no argument, or if the maindirecroty is not a directory or the given permission is not supported, the script should print an error message to stderr and exit. Somple chmodAllDirectories 600 students c) Print all empty directories. Write a shell script printEmptyDirectories directory that will print all empty directories as a full path. The command printEmptyDirectories directory should print all empty directories inside the given argument directory. Note: du command cannot be used in writing this script If there is no argument, or if the maindirectory is not a directory, the script should print an error message to stderr and exit. Sample /printEmptyDirectories home /home/students/u1200735/mydir /home/students/u1190665/linkdir /home/myfiles/test 2. Files: a) Write a shell script, removeX, that will remove x permission of a given file from a given set of directories. The command removeX filel d1d2d3..dn removes the execution property of filel inside that is laying inside d1d2d3..dn directories. If there is no argument, or if file1 is not a regular file or directory 1 is not a directory, then the script should print an error message to stderr and exit. b) Compare files: Write a compare script that accepts two files as arguments: the script should return a code of 0 if the second file is a copy of the first file (They are identical). The return code will be 1 if they are different. c) Delete all duplicate files Write a shell script to deleteDuplicate that deletes all files (Keep one and remove the other) that are a copy of a given file. The command deletes replication f1f2fn should remove all the files f2 through fn that are exact copies of f1. Use compare script from part (b) to detect whether two files are identical. Sample: (Assume that the midterm file in directory dir1 has another copy inside directory dir2) /deleteDuplication dir1 dir2 File midterm has been deleted from the dir2 directory If there aren't two arguments or dir1 and dir2 are not a directory, the script should print an appropriate error message to stderr and exit. 3. Report: a) Count and display all files that contain the exact word: Write a countWord script that accepts as many arguments as possible (up to 8): the word to search for and a list of directories. The script should display all files with their directories. Your script should print an error if: - The first argument is not a type of regular file - The number of arguments is less than two. Sample: ./countWord Computer Comp311 Comp433 Comp438 The Word "Computer" appears 4 times in the following Files with the corresponding lines /Comp 311/midterm. doc line 10 /Comp 311/ resume.txt line 5 /Comp433/technology.txt. line 3 /Comp438/Myfiles.html line 25 b) Count the number of files that have the same name inside different directories. Write a countFiles script that accepts two directories as arguments: the script should display all files with the same name. Your script should print an error if: - the first argument is not a type of directories - the number of arguments is not equal to two. Sample: ./ countFiles Comp311 Comp2311 The following files appear in the directories "Comp311" and "Comp2311" Hel1o. Java Test. c Final.html c) Print all empty files. Write a shell script printEmptyFiles that will print all empty file names. The command printEmptyFiles file should print all empty files inside a given set of directories. Note: the option -s for checking the file size (if I-s file /) or du command cannot be used in writing this script. Sample The script should print an error message to stderr and exit if there is no argument or the argument is not a directory. 1. Exit Script Allows the user to stop running the script and exit with the message "Goodbye." IF ANYONE USE ANY COMMAND OR SYNTAX NOT IS NOT MENTIONED IN THE LAB MANUAL, THEN THIS SCRIPT WILL BE NOT GRADED (ZERO GRADE). JUST YOU CAN ONLY USE OPERATIONS LIKE (Re, \|, ) if you need it. Operation Explanation && The logical AND || The logical OR. 1 The logical NOT (depending on the exit status) Example: if [ [ (\$1-1t 10) \&\& (\$2 -gt 2) ]] then echo "Approved" echo "Quit!" exit 0
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started