Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Ad icon
port.lk Domain for sale
Lankan-Tech
Updated:
Today at 3:55 PM
Colombo
Kaduwela - Two Storey House for Sale
dilrasan
Updated:
Thursday at 2:23 PM
Ad icon
Wechat qr verification
Pawan2005
Updated:
Thursday at 1:28 AM
🚀 GOOGLE AI PRO 18 MONTHS ACTIVATION 🚀
sayuru bandara
Updated:
Wednesday at 5:34 PM
Pure VPN - Up to 27 Months
vgp
Updated:
Jun 5, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri PRO!
Professional Linux Help and Support Thread
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="nadman123" data-source="post: 1798450" data-attributes="member: 86564"><p><strong>Please help me to write this script</strong></p><p></p><p><span style="font-family: 'Times New Roman'"><span style="font-size: 12px"><p style="text-align: left">write a UNIX shell script (Bourne shell syntax) called</p><p></span></span><strong><span style="font-family: 'Times New Roman'"><span style="font-size: 12px"><p style="text-align: left">admin_script</p><p></span></span></strong><span style="font-family: 'Times New Roman'"><span style="font-size: 12px"><p style="text-align: left"></p><p></span><p style="text-align: left"></p><p></span><p style="text-align: left"><span style="font-family: 'Times New Roman'"><span style="font-size: 12px">. This script is described below as a usage summary:</span></span></p><p><span style="font-family: 'Times New Roman'"><span style="font-size: 12px"></span></span></p><p><span style="font-family: 'Times New Roman'"><span style="font-size: 12px"></span></span><strong><span style="font-family: 'Courier New'"><span style="font-size: 10px"><p style="text-align: left">admin_script [ -l n ] [ -f n ] [ -s username ] [ -d username ]</p></span></span></strong></p><p style="text-align: left"><strong><span style="font-family: 'Courier New'"><span style="font-size: 10px">[ -b username yyyymm ] [ -c ]</p><p></span></span></strong><em><span style="font-family: 'Courier New'"><span style="font-size: 10px"><p style="text-align: left">Note: if no options are specified, a menu is displayed which allows</p></span></span></em></p><p style="text-align: left"><em><span style="font-family: 'Courier New'"><span style="font-size: 10px">users to perform </p><p></span><p style="text-align: left"></p><p></span><p style="text-align: left"><strong><span style="font-family: 'Courier New'"><span style="font-size: 10px">one </span></span></strong><span style="font-family: 'Courier New'"><span style="font-size: 10px">of the following tasks and then </span></span><strong><span style="font-family: 'Courier New'"><span style="font-size: 10px">exit</span></span></strong><span style="font-family: 'Courier New'"><span style="font-size: 10px">. If</span></span></p></em></p><p style="text-align: left"><em><span style="font-family: 'Courier New'"><span style="font-size: 10px">incorrect options are provided, an error message is echoed to standard</span></span></p></em></p><p style="text-align: left"><em><span style="font-family: 'Courier New'"><span style="font-size: 10px">output followed by the usage line above and an appropriate exit value</span></span></p></em></p><p style="text-align: left"><em><span style="font-family: 'Courier New'"><span style="font-size: 10px">should be returned to the shell. Any combination of the options can be</span></span></p></em></p><p style="text-align: left"><em><span style="font-family: 'Courier New'"><span style="font-size: 10px">provided by the user and the options do not have to be provided in the</span></span></p></em></p><p style="text-align: left"><em><span style="font-family: 'Courier New'"><span style="font-size: 10px">order given in the usage message.</span></span></p><p><span style="font-family: 'Courier New'"><span style="font-size: 10px"></span></span></em></p><p><em><span style="font-family: 'Courier New'"><span style="font-size: 10px"></span></span></em><strong><span style="font-family: 'Courier New'"><span style="font-size: 10px"><p style="text-align: left">-l n</p><p></span></span></strong><span style="font-family: 'Courier New'"><span style="font-size: 10px"><p style="text-align: left">Display the last </p><p></span><p style="text-align: left"></p><p></span><p style="text-align: left"><em><span style="font-family: 'Courier New'"><span style="font-size: 10px">n </span></span></em><span style="font-family: 'Courier New'"><span style="font-size: 10px">lines of the /etc/passwd file</span></span></p><p><span style="font-family: 'Courier New'"><span style="font-size: 10px"></span></span></p><p><span style="font-family: 'Courier New'"><span style="font-size: 10px"></span></span><strong><span style="font-family: 'Courier New'"><span style="font-size: 10px"><p style="text-align: left">-f n</p><p></span></span></strong><span style="font-family: 'Courier New'"><span style="font-size: 10px"><p style="text-align: left">Display the first </p><p></span><p style="text-align: left"></p><p></span><p style="text-align: left"><em><span style="font-family: 'Courier New'"><span style="font-size: 10px">n </span></span></em><span style="font-family: 'Courier New'"><span style="font-size: 10px">lines of the /etc/passwd file</span></span></p><p><span style="font-family: 'Courier New'"><span style="font-size: 10px"></span></span></p><p><span style="font-family: 'Courier New'"><span style="font-size: 10px"></span></span><strong><span style="font-family: 'Courier New'"><span style="font-size: 10px"><p style="text-align: left">-s username</p><p></span></span></strong><span style="font-family: 'Courier New'"><span style="font-size: 10px"><p style="text-align: left">Display the full path name of the login shell used by </p><p></span><p style="text-align: left"></p><p></span><p style="text-align: left"><em><span style="font-family: 'Courier New'"><span style="font-size: 10px">username</span></span></em></p><p><em><span style="font-family: 'Courier New'"><span style="font-size: 10px"></span></span></em></p><p><em><span style="font-family: 'Courier New'"><span style="font-size: 10px"></span></span></em><strong><span style="font-family: 'Courier New'"><span style="font-size: 10px"><p style="text-align: left">-d username</p><p></span></span></strong><span style="font-family: 'Courier New'"><span style="font-size: 10px"><p style="text-align: left">For the home directory of </p><p></span><p style="text-align: left"></p><p></span><p style="text-align: left"><em><span style="font-family: 'Courier New'"><span style="font-size: 10px">username</span></span></em><span style="font-family: 'Courier New'"><span style="font-size: 10px">, display an English language string</span></span></p> <p style="text-align: left"><span style="font-family: 'Courier New'"><span style="font-size: 10px">which shows the permissions of the user’s home directory.</span></span></p> <p style="text-align: left"><span style="font-family: 'Courier New'"><span style="font-size: 10px">For example, suppose the home directory of </span></span><em><span style="font-family: 'Courier New'"><span style="font-size: 10px">cwilson </span></span></em><span style="font-family: 'Courier New'"><span style="font-size: 10px">has the following</span></span></p> <p style="text-align: left"><span style="font-family: 'Courier New'"><span style="font-size: 10px">permission string:</span></span></p> <p style="text-align: left"><span style="font-family: 'Courier New'"><span style="font-size: 10px">drwxr-xr-- … /home/cwilson</span></span></p> <p style="text-align: left"><span style="font-family: 'Courier New'"><span style="font-size: 10px">In this case the output from the script would be:</span></span></p><p><span style="font-family: 'Courier New'"><span style="font-size: 10px"></span></span></p><p><span style="font-family: 'Courier New'"><span style="font-size: 10px"></span></span><strong><span style="font-family: 'Courier New'"><span style="font-size: 10px"><p style="text-align: left">User cwilson’s home directory has the following permissions set:</p></span></span></strong></p><p style="text-align: left"><strong><span style="font-family: 'Courier New'"><span style="font-size: 10px">Read,Write and Execute for the user.</p></span></span></strong></p><p style="text-align: left"><strong><span style="font-family: 'Courier New'"><span style="font-size: 10px">Read and Execute for the group.</p></span></span></strong></p><p style="text-align: left"><strong><span style="font-family: 'Courier New'"><span style="font-size: 10px">Read only for others.</p></span></span></strong></p><p style="text-align: left"><strong><span style="font-family: 'Courier New'"><span style="font-size: 10px">-b username yyyymm</p><p></span></span></strong><span style="font-family: 'Courier New'"><span style="font-size: 10px"><p style="text-align: left">Perform a backup of the files in home directory of </p><p></span><p style="text-align: left"></p><p></span><p style="text-align: left"><em><span style="font-family: 'Courier New'"><span style="font-size: 10px">username</span></span></em><span style="font-family: 'Courier New'"><span style="font-size: 10px">. However,</span></span></p> <p style="text-align: left"><span style="font-family: 'Courier New'"><span style="font-size: 10px">when using this option we only want to backup files which have been</span></span></p> <p style="text-align: left"><span style="font-family: 'Courier New'"><span style="font-size: 10px">modified during the month specified in the option. The month is</span></span></p> <p style="text-align: left"><span style="font-family: 'Courier New'"><span style="font-size: 10px">specified as a four digit year followed by a two digit month (e.g.</span></span></p> <p style="text-align: left"><span style="font-family: 'Courier New'"><span style="font-size: 10px">200804 refers to April 2008). The files should be backed up to a</span></span></p> <p style="text-align: left"><span style="font-family: 'Courier New'"><span style="font-size: 10px">directory called .backup in the home directory of </span></span><em><span style="font-family: 'Courier New'"><span style="font-size: 10px">username</span></span></em><span style="font-family: 'Courier New'"><span style="font-size: 10px">. If this</span></span></p> <p style="text-align: left"><span style="font-family: 'Courier New'"><span style="font-size: 10px">directory does not exist when the script is run, it must be created by</span></span></p> <p style="text-align: left"><span style="font-family: 'Courier New'"><span style="font-size: 10px">the script.</span></span></p><p><span style="font-family: 'Courier New'"><span style="font-size: 10px"></span></span></p><p><span style="font-family: 'Courier New'"><span style="font-size: 10px"></span></span><strong><span style="font-family: 'Courier New'"><span style="font-size: 10px"><p style="text-align: left">-c</p><p></span></span></strong><span style="font-family: 'Courier New'"><span style="font-size: 10px"><p style="text-align: left">Return a count of all users registered on the system (not just those</p></span></span></p><p style="text-align: left"><span style="font-family: 'Courier New'"><span style="font-size: 10px">users logged on) whose UID is greater than 500</p><p></span></span><strong><span style="font-family: 'Courier New'"><span style="font-size: 10px"><p style="text-align: left">-h</p><p></span></span></strong><span style="font-family: 'Courier New'"><span style="font-size: 10px"><p style="text-align: left">Send information to standard output regarding the author (including</p></span></span></p><p style="text-align: left"><span style="font-family: 'Courier New'"><span style="font-size: 10px">student-id number) of the program and the date it was written</p><p></span></span></p></blockquote><p></p>
[QUOTE="nadman123, post: 1798450, member: 86564"] [b]Please help me to write this script[/b] [FONT=Times New Roman][SIZE=3][LEFT]write a UNIX shell script (Bourne shell syntax) called[/LEFT] [/SIZE][/FONT][B][FONT=Times New Roman][SIZE=3][LEFT]admin_script[/LEFT][/SIZE][/FONT][/B][FONT=Times New Roman][SIZE=3][LEFT][/left][/SIZE][LEFT][/left][/FONT][LEFT][FONT=Times New Roman][SIZE=3]. This script is described below as a usage summary:[/SIZE][/FONT][/LEFT][FONT=Times New Roman][SIZE=3] [/SIZE][/FONT][B][FONT=Courier New][SIZE=2][LEFT]admin_script [ -l n ] [ -f n ] [ -s username ] [ -d username ] [ -b username yyyymm ] [ -c ][/LEFT] [/SIZE][/FONT][/B][FONT=Courier New][SIZE=2][/SIZE][/FONT][I][FONT=Courier New][SIZE=2][LEFT]Note: if no options are specified, a menu is displayed which allows users to perform [/LEFT][/SIZE][LEFT][/left][/FONT][LEFT][B][FONT=Courier New][SIZE=2]one [/SIZE][/FONT][/B][FONT=Courier New][SIZE=2][/SIZE][/FONT][FONT=Courier New][SIZE=2]of the following tasks and then [/SIZE][/FONT][B][FONT=Courier New][SIZE=2]exit[/SIZE][/FONT][/B][FONT=Courier New][SIZE=2][/SIZE][/FONT][FONT=Courier New][SIZE=2]. If incorrect options are provided, an error message is echoed to standard output followed by the usage line above and an appropriate exit value should be returned to the shell. Any combination of the options can be provided by the user and the options do not have to be provided in the order given in the usage message.[/SIZE][/FONT][/LEFT][FONT=Courier New][SIZE=2] [/size][/font][/I][FONT=Courier New][SIZE=2][/SIZE][/FONT][B][FONT=Courier New][SIZE=2][LEFT]-l n[/LEFT] [/SIZE][/FONT][/B][FONT=Courier New][SIZE=2][/SIZE][/FONT][FONT=Courier New][SIZE=2][LEFT]Display the last [/LEFT][/SIZE][LEFT][/left][/FONT][LEFT][I][FONT=Courier New][SIZE=2]n [/SIZE][/FONT][/I][FONT=Courier New][SIZE=2][/SIZE][/FONT][FONT=Courier New][SIZE=2]lines of the /etc/passwd file[/SIZE][/FONT][/LEFT][FONT=Courier New][SIZE=2] [/SIZE][/FONT][B][FONT=Courier New][SIZE=2][LEFT]-f n[/LEFT] [/SIZE][/FONT][/B][FONT=Courier New][SIZE=2][/SIZE][/FONT][FONT=Courier New][SIZE=2][LEFT]Display the first [/LEFT][/SIZE][LEFT][/left][/FONT][LEFT][I][FONT=Courier New][SIZE=2]n [/SIZE][/FONT][/I][FONT=Courier New][SIZE=2][/SIZE][/FONT][FONT=Courier New][SIZE=2]lines of the /etc/passwd file[/SIZE][/FONT][/LEFT][FONT=Courier New][SIZE=2] [/SIZE][/FONT][B][FONT=Courier New][SIZE=2][LEFT]-s username[/LEFT] [/SIZE][/FONT][/B][FONT=Courier New][SIZE=2][/SIZE][/FONT][FONT=Courier New][SIZE=2][LEFT]Display the full path name of the login shell used by [/LEFT][/SIZE][LEFT][/left][/FONT][LEFT][I][FONT=Courier New][SIZE=2]username[/SIZE][/FONT][/I][/LEFT][I][FONT=Courier New][SIZE=2] [/size][/font][/I][FONT=Courier New][SIZE=2][/SIZE][/FONT][B][FONT=Courier New][SIZE=2][LEFT]-d username[/LEFT] [/SIZE][/FONT][/B][FONT=Courier New][SIZE=2][/SIZE][/FONT][FONT=Courier New][SIZE=2][LEFT]For the home directory of [/LEFT][/SIZE][LEFT][/left][/FONT][LEFT][I][FONT=Courier New][SIZE=2]username[/SIZE][/FONT][/I][FONT=Courier New][SIZE=2][/SIZE][/FONT][FONT=Courier New][SIZE=2], display an English language string which shows the permissions of the user’s home directory. For example, suppose the home directory of [/SIZE][/FONT][I][FONT=Courier New][SIZE=2]cwilson [/SIZE][/FONT][/I][FONT=Courier New][SIZE=2][/SIZE][/FONT][FONT=Courier New][SIZE=2]has the following permission string: drwxr-xr-- … /home/cwilson In this case the output from the script would be:[/SIZE][/FONT][/LEFT][FONT=Courier New][SIZE=2] [/SIZE][/FONT][B][FONT=Courier New][SIZE=2][LEFT]User cwilson’s home directory has the following permissions set: Read,Write and Execute for the user. Read and Execute for the group. Read only for others. -b username yyyymm[/LEFT] [/SIZE][/FONT][/B][FONT=Courier New][SIZE=2][/SIZE][/FONT][FONT=Courier New][SIZE=2][LEFT]Perform a backup of the files in home directory of [/LEFT][/SIZE][LEFT][/left][/FONT][LEFT][I][FONT=Courier New][SIZE=2]username[/SIZE][/FONT][/I][FONT=Courier New][SIZE=2][/SIZE][/FONT][FONT=Courier New][SIZE=2]. However, when using this option we only want to backup files which have been modified during the month specified in the option. The month is specified as a four digit year followed by a two digit month (e.g. 200804 refers to April 2008). The files should be backed up to a directory called .backup in the home directory of [/SIZE][/FONT][I][FONT=Courier New][SIZE=2]username[/SIZE][/FONT][/I][FONT=Courier New][SIZE=2][/SIZE][/FONT][FONT=Courier New][SIZE=2]. If this directory does not exist when the script is run, it must be created by the script.[/SIZE][/FONT][/LEFT][FONT=Courier New][SIZE=2] [/SIZE][/FONT][B][FONT=Courier New][SIZE=2][LEFT]-c[/LEFT] [/SIZE][/FONT][/B][FONT=Courier New][SIZE=2][/SIZE][/FONT][FONT=Courier New][SIZE=2][LEFT]Return a count of all users registered on the system (not just those users logged on) whose UID is greater than 500[/LEFT] [/SIZE][/FONT][B][FONT=Courier New][SIZE=2][LEFT]-h[/LEFT] [/SIZE][/FONT][/B][FONT=Courier New][SIZE=2][/SIZE][/FONT][FONT=Courier New][SIZE=2][LEFT]Send information to standard output regarding the author (including student-id number) of the program and the date it was written[/LEFT] [/SIZE][/FONT] [/QUOTE]
Insert quotes…
Verification
Dawasata paya keeyak thibeda?
Post reply
Top
Bottom