This is a homework assignment to create the below described shell scripts. I need the scripts so I can complete my university education. If you would like to help me and can create these scripts, please send them in a zip or rar file to my email: email@example.com
Task 1: Compile a script named zad1.sh, which script receives as parameters a list of users (usernames). When executed, the script reads text from the standard input and sends it to those users in the list who have started a session and working in it.
Hint: - You can use write for sending - If we want to send a message to users, i.e. to the users unix, student1 and student2, the script can be started as below:
$ ./zad1.sh unix student1 student2 It reads from the standard input, checks which users have been logged in (i.e. unix and student2) and sends them what the script has read.
Task2: Compile a script zad2.sh, which shows on the screen the files in the current directory, grouped in three columns.
Tasks3: Compile a script zad3.sh, which would ask for a username and show this username on the screen and with it the HOME directory of this user. If the user does not exist, a proper message has to be generated.
Task4: Running $ ll 1> - a file is being created: - $ ll -rw-rw-r-- 1 user1 users 35 Nov 30 15:41 -
How can we see the content of the created file "-"? Compile a script zad4.sh with the proper command.
Task5: Below is the content of the file /var/log/messages
... Nov 28 11:30:58 x-wing mon: no monitor found while trying to run [http.monitor] Nov 28 11:36:10 x-wing mon: no monitor found while trying to run [ping.monitor] Nov 28 11:36:18 x-wing mon: no monitor found while trying to run [telnet.monitor] ... The multiple dots (...) are lines with unknown content, which follow the chronological order.
Compile a script zad5.sh, which shows the messages from the last minute (the messages received within the same minute in which the script is being executed).
Example: If the date at the moment when the script was run is November 28, 11:36 AM, we would have: Nov 28 11:36:10 x-wing mon: no monitor found while trying to run [ping.monitor] Nov 28 11:36:18 x-wing mon: no monitor found while trying to run [telnet.monitor] ...
PS: If the script is named zad5.sh, the answer can be tested by: $ ./zad5_test.sh ; ./zad5.sh where zad5_test.sh is: $ cat zad5_test.sh # Testing the task for generating the messages from the last minute # The script adds to the file messages from the last minute echo `date +%b" "%d" "%H":"%M:%S` Test message >> /var/log/messages
Task6: - Compile a script with name zad6.sh, which shows its name (the name of the executed file). Example: Assume the script is called zad6.sh and is located in the home directory of user unix. $ ./zad6.sh Hi,I am a script! My name is: zad6.sh
- The script has to generate its own name, regardless of how the script is started - by relative or absolute name, regardless of the current directory, thus it has to remove the directory and the suffix from the filename.
Hint: - Some commands that can be used: cut, wc, tr - There is a command for removing a directory/suffix from a filename - basename, which can be used in case you cannot go without it.
Task7: Script (zad7.sh) receives one argument as a parameter - string. If a subdirectory of the user's HOME directory does not exist (the user who launches the script), with a name that is the same as the given string, the script created it, copies into it all common files from the current directory, that are available to read and generates on the standard output the number of the rest.
Task8: a) Compile a script zad8a.sh which shows on the screen in alphabetical order all users in the system and their user ID numbers (UID) in a format (sorting is by username):
Compile a script zad9.sh , which accepts as input parameter the filename and generates to the standard output the user and its password. Note: A user is uid = value of the line starting with dn: User's password is the value of userPassword::
Example: $ ./zad9.sh test.ldap rhiz e2rhizXB0fSQxJHFVS1VaL3RzJHlwbkNtbm5KeG9kM2zE0RWZKaFd= hristo e2hristoB0fSQxJExEMDBkaElxJEo5dzNScy5yNzhqMHZCLzdjYUdSTi4= ... and so on.