Need Help With making this script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need Help With making this script
# 1  
Old 10-30-2014
Linux Need Help With making this script

Hello, im a new user on this site and learning scripting very slowly at a understanding pace. However i am up with a challenge and require help completing this.

The script has to include arguments, variables, decisions and loops. So the script is about calculating the broadcast address for any given IP address and subnet mask...below is the layout of script details, Any help?

Code:
$ ./my_broadcast_calc 172.16.200.123/255.255.255.0


            172.16.200.255


 $ ./my_broadcast_calc 172.16.200.123/25


            172.16.200.255


 $ ./my_broadcast_calc 172.16.200.123/0xffffff00 -hex


            0xac10c8ff


The script should be able to handle the option –hex (which means display the final output in hexadecimal format). If the option is not provided, the the script should always display the result as in decimal (base 10) format.

Last edited by rbatte1; 11-03-2014 at 10:38 AM.. Reason: Added CODE tags
# 2  
Old 10-30-2014
Is this a homework assignment?
# 3  
Old 10-30-2014
This is assignment from my course. The thing is i never learned how to deal with IP addresses in scripting :/
# 4  
Old 10-30-2014
There is a separate forum for homework and I'm sure Don will fill you in on the rules around this.

As source of some related code have a look the following thread pinned on this forum:
Convert ip ranges to CIDR netblocks
# 5  
Old 10-30-2014
Thanks Chubler_XL, i dont even know where to begin with this question. I feel like im naked in the cold alone lol. Hope some expert that can guide me with this Smilie
# 6  
Old 10-31-2014
Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum under special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

More-than-likely, posting homework in the main forums has resulted in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.

If you did post homework in the main forums, please review the guidelines for posting homework and repost.

Thank You.

The UNIX and Linux Forums.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Help me making this script

This script is executed whenever a new vehicle is added to the cycle-motor park of campus. The script asks for the following information about the car and adds a new line to the vehicle file.txt: name (name of an animal, unique identifier), color, mark, model, type (e.g., electrical, manual),... (2 Replies)
Discussion started by: andre2222
2 Replies

2. AIX

Making a trace for a script

Hello experts, I'm trying to make a trace (unix log) in hope to see why I have differences in some bases : I putted at the first { and in the last line } > $DATA_SAS 2>&1 Is it a right command ? Do you have another solution ? thank you, regards, (7 Replies)
Discussion started by: rimob
7 Replies

3. Shell Programming and Scripting

Making any script executable

Hi all, I'm new to Unix so just wanted some help. I've been self learning and came accross a question online that I was trying. It is to make any shell script executable, the name of the file is to be made executable. I would use nano and type in something like #! /bin/bash Chmod +x... (4 Replies)
Discussion started by: HelenaR
4 Replies

4. Shell Programming and Scripting

I could use some help with making a script

I run a small instrument lab. We track our user's time on the instruments with a very manual process of 'last wtmp.1' then cut/paste data into spreadsheets. My boss makes the initial spreadsheets then I convert and format them for uploading into our billing software (COReS). Cores is looking for a... (8 Replies)
Discussion started by: jpontius
8 Replies

5. Shell Programming and Scripting

Help making a tasklog script

I am trying to create a program called tasklog that integrates with one of my online accounts, to keep track of what tasks I have been working on. On login, I'd like it to display (up to) the five most recent entries, then ask me what I plan to work on during the new session. I then will type an... (3 Replies)
Discussion started by: santod
3 Replies

6. Shell Programming and Scripting

making shell script

Hi , I am new to shell scripting I want to make script as to execute followng command mysqldump -u (user name) -p(password) database name>filename.sql this file saves with current date and time and execute automatically at particular time which I give (10 Replies)
Discussion started by: kaushik02018
10 Replies

7. Shell Programming and Scripting

making script

hello experts cany any one help me i want to make one script which can rlogin to another machine . but it should not ask me username/password from me of another machine it should take the username and password from the script only. please help me out. regards, shary (2 Replies)
Discussion started by: shary
2 Replies

8. Shell Programming and Scripting

Need help making a script

Here is what I have: #!/bin/bash # Setup year date and month YR=`date +%Y '{print $6}'` MON=`date +%b '{print $2}'` DAY=`date +%d '{print $3}'` file=$YR$MOY$DOM # clear # Dump database using USER/PASS to ..sql mysqldump --user=me -ppass database > database-db.$file.sql The YR, MON and... (2 Replies)
Discussion started by: npereira
2 Replies

9. Shell Programming and Scripting

Making flags for my script

I have no idea how to make my own flags. (6 Replies)
Discussion started by: rcunn87
6 Replies

10. Shell Programming and Scripting

Making a script exectuable

Hi, I'm pretty new to Unix and I just have a question concerning making a script executable without putting the "sh" command before it. In case it makes the difference I am on an Apple computer using the Terminal. Anyway here is the little test code I wrote followed by the commands I took to try to... (5 Replies)
Discussion started by: BuyoCat
5 Replies
Login or Register to Ask a Question