LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-11-2013, 12:24 AM   #1
HeLpInLiNuX
LQ Newbie
 
Registered: Nov 2013
Posts: 7

Rep: Reputation: Disabled
HELP LAB due 11/13/13 and I don't know where to START!!


ANY HELP WOULD BE SO VERY GREATLY APPRECIATED! THANK YOU

In the "linux1" system create a lab3 directory below your home directory. Under the lab 3 directory using the "bash shell" write a shell script for each of the following:

1. Write a script named "monthyr.bash". The script will prompt the user for the month and then the desired year to be displayed on the screen. Then your script will execute and display the desired calendar month and year on screen.

2. Write a script named "dusage.bash" . The script will prompt for the user’s login or user name and then display the amount of diskspace being used by the user.

3. Write a script "total.bash" that will calculate the total amount purchased based on the number of units purchased @ $10 each.

4. Write a shell script named “loguser.bash”. Upon execution the script will wait 5 seconds and then display output as to whether the user “wmorris” is logged in with a session.


10 Bonus Points:

Write a script named “menu.bash” that will prompt the user for a selection of items. The menu should display the as following items for the user and execute each item:



Main Menu

1. Mail
2. Vi
3. Directory Listing
4. Exit

PLEASE HELP ME IN ANY WAY. I WILL PAY YOU...IM NOT ONLY DOING THIS FOR MYSELF BUT MY DAUGHTER...GOING THRU A DIVORCE, WORKING A FULL TIME JOB AND GOING TO SCHOOL IS ABOUT TO KILL ME.

Last edited by HeLpInLiNuX; 11-11-2013 at 12:37 AM.
 
Old 11-11-2013, 01:13 AM   #2
HeLpInLiNuX
LQ Newbie
 
Registered: Nov 2013
Posts: 7

Original Poster
Rep: Reputation: Disabled
I dont just want someone to give me the answer...it would be nice but i highly doubt anyone will....
So i think once i log in and open lab 3 i open the vi editor and start with ./bin/bash ?
Then i get confused....

An example....anything will help
 
Old 11-11-2013, 01:36 AM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Definitely bookmark and read http://rute.2038bug.com/index.html.gz.

When creating a bash script, set this as the first line
Code:
#!/bin/bash
set -xv
The 1st line tells the system which interpreter (parser) to use.
Note that you should check the '/bin/bash' part by typing
Code:
which bash
at the cmd line (hereinafter known as cli).

The 2nd line is for debug purposes only; basically it shows you what you typed and how the parser translated it and what the resultant cmd & results looked like.
Worth its weight in gold

Normally a comment line starts with '#', but the 1st line above (sometimes known as the 'shebang' line) is an exception.

If posting code/data to LQ, please use code tags as explained here https://www.linuxquestions.org/quest...do=bbcode#code.

Welcome to LQ
 
Old 11-11-2013, 01:39 AM   #4
HeLpInLiNuX
LQ Newbie
 
Registered: Nov 2013
Posts: 7

Original Poster
Rep: Reputation: Disabled
thank you so much for your help....

would the next line be chmod +x "monthyr.bash"
 
Old 11-11-2013, 01:45 AM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
At the cli yes; do not confuse the script content with the cmds in the cli env. (eg chmod, chown etc).
It can be a little confusing because a bash script is just putting cmds you can use at the cli into a file and running the file instead.
Basically automating something you could otherwise type in by hand every time.

Do read the Rute guide; its very good.

PS actually
Code:
chmod u+x script.sh
This only grants execution privs to the user aka owner; no need to let anyone run your stuff.

PPS: please use code tags as requested; thank you

Last edited by chrism01; 11-11-2013 at 01:46 AM.
 
1 members found this post helpful.
Old 11-11-2013, 06:37 AM   #6
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Moderator Response

Welcome to LQ!

Quote:
Per the LQ Rules, please do not post homework assignments verbatim. We're happy to assist if you have specific questions or have hit a stumbling point, however. Let us know what you've already tried and what references you have used (including class notes, books, and Google searches) and we'll do our best to help. Also, keep in mind that your instructor might also be an LQ member.
I suggest that you approach the instructor/professor with this issue since he/she would be best to help you with the assignment from the text or classroom presentation/assignment perspective. That way you will be able to learn from your weakness or areas that do need attention.

In addition to your text or notes;
Quote:
Just a few links to aid you to gaining some understanding;



1 Linux Documentation Project
2 Rute Tutorial & Exposition
3 Linux Command Guide
4 Bash Beginners Guide
5 Bash Reference Manual
6 Advanced Bash-Scripting Guide
7 Linux Newbie Admin Guide
8 LinuxSelfHelp
9 Ultimate Linux Newbie Guide
10
Linux Home Networking
11
Virtualization- Top 10

The above links and others can be found at 'Slackware-Links'. More than just SlackwareŽ links!
For when you do have questions then read this before posting;
Quote:
FYI: I suggest that you look at 'How to Ask Questions the Smart Way' so in the future your queries provide information that will aid us in diagnosis of the problem or query.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Got a linux admin lab final due. can any one help please! MDtoakers Linux - Networking 2 11-18-2010 07:37 PM
Start over with new distro due to problems. pressurehead Linux - Newbie 5 08-06-2010 10:08 AM
How to chown -R don.lab * for don.users Hans Zilles Linux - Newbie 3 11-15-2005 07:53 AM
apt don't work due to nvidia Mathsniper Debian 8 04-15-2005 07:15 AM
Programs in FluxBox take ages to start or don't start at all hubabuba Slackware 1 02-20-2005 09:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration