Question
1. Write a Bourne Shell script named Script_1.1.sh to rename all files in a subdirectory called Script_1 to prepend and append the letter X to
1. Write a Bourne Shell script named Script_1.1.sh to rename all files in a subdirectory called Script_1 to prepend and append the letter X to the file name. For example, testfile would become XtestfileX
2. Write a second script Script_1.2.sh that will reverse the change from above
3. Write an interactive shell script that will prompt for a search string, and then identify any files in the subdirectory Script_2 that contains the specified string.
4. Write a script that will use a while loop to read the contents of a file active_cs.txt and process as follows: Note: Do not alter the logic I am intentionally requiring the nested if-else statement.
Username:Full Name:StudentIDNum:Advisor Name If the username in first field of the input record does not exist in /home STUDENTS/majors
o if
the username exists in /home/STUDENTS/nonmajors display message CS MAJOR fullname is in nonmajor
o otherwise
display message NO ACCOUNT FOUND current record read
Alias Commands
1. Write an alias that will cancel all print requests associated with your username by typing cancel_print
2. Write an alias that you believe would be useful and provide explanation of what its intended to do and why. You must come up with something unique so do not work together and dont use anything weve done in class.
The two alias commands should be placed in a file named my_alias.txt and include the explanation for the second one below the command as a comment.
Adding Users - Part 1
Given a data file new_users.txt with the same record format as /etc/passwd shown below: username:password:uid:gid:GECOS:homedir:shell Write a shell script that will generate the command necessary to add each user. This command must include each of the following:
1. Username
2. GECOS
3. Home directory
4. Create home directory and load skeleton files from a directory /home/csadmin/SKEL
5. Specify shell
Your program should DISPLAY the command generated for each record on the screen. DO NOT attempt to actually execute the command to add the users.
Adding Users - Part 2
Write a script that will take input from cs_roster.txt file made available by the IT department and generate the new_users.txt file that is used as input for the script in Adding Users - Part 1.
Prefix Number Section|username|Full Name|Student_ID|major1|major2
Please note:
1. No accounts should be created for students enrolled in CMPSC 1513
2. No accounts should be created for students enrolled in any course with CPSMA as a prefix except CPSMA 2923 which is our Data Structures class
3. The major code for Computer Science is 0510.
4. Any student that has declared Computer Science as his/her first or second major should have their home directory in /home/STUDENTS/majors
5. Any student that does not have Computer Science as a major should have home directory in /home/STUDENTS/nonmajors
Use a local copy of cs_roster.txt file for input directly. This will enable you to alter the file any way you wish for testing and so can I...
Modifying Users Given the input file active_cs.txt with the following layout generate an output file, modified_users.txt, that will contain the series of commands that would need to be executed to perform the following modifications:
Username:Full Name:StudentIDNum:Advisor Name
Name Changes
Note: May include both username and GECOS field modifications
Major Changes
Note: May include changing to or from Computer Science major and should result in appropriate placement of home directory.
Deleting Users
Write a single command that would be used to delete user from the system including removing his/her home directory. Demonstrate this using a sample student named olduser that has a home directory among the nonmajors.
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