Jump to content

Welcome to canucks.com Vancouver Canucks homepage

Photo

Unix HELP!


This topic has been archived. This means that you cannot reply to this topic.
14 replies to this topic

#1 Zach Parise

Zach Parise

    Canucks First-Line

  • Members
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 6,410 posts
  • Joined: 20-March 09

Posted 26 March 2013 - 06:09 PM

hey fellow canucks !

im stuck on an assignment for UNIX command and looking for a solution heres the question.

Write a script in Korn shell to input two positive integer numbers “N” and “M” then perform the following:
  • If “N” is not smaller than “M” then you need to ask user to enter another set of values for “N” and “M”
  • If the input value for “N” is smaller than “M” then
  • Display all the even numbers between the “N” and ‘M”
So basically I have to enter a number say 1 and another number 56

and in between those 2 numbers i must display all the even numbers

any help?

#2 Bring_Back_Bertuzzi

Bring_Back_Bertuzzi

    Comets Star

  • Members
  • PipPipPipPipPipPip
  • 965 posts
  • Joined: 18-February 13

Posted 26 March 2013 - 06:11 PM

good luck with that

luo_sig_with_words.jpg


#3 Jagr68

Jagr68

    Comets Prospect

  • Members
  • PipPipPipPip
  • 219 posts
  • Joined: 09-March 13

Posted 26 March 2013 - 06:17 PM

Posted Image

#4 Lillooet_Hillbilly

Lillooet_Hillbilly

    Comets Star

  • Members
  • PipPipPipPipPipPip
  • 769 posts
  • Joined: 04-July 11

Posted 26 March 2013 - 06:18 PM

i like pancakes

#5 Bring_Back_Bertuzzi

Bring_Back_Bertuzzi

    Comets Star

  • Members
  • PipPipPipPipPipPip
  • 965 posts
  • Joined: 18-February 13

Posted 26 March 2013 - 06:21 PM

Posted Image

lolololololololololol

luo_sig_with_words.jpg


#6 The Magician

The Magician

    Canucks First-Line

  • Banned
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 5,921 posts
  • Joined: 13-January 12

Posted 26 March 2013 - 06:22 PM

Haha best of luck I have no clue

nN5BCfs.jpg


#7 Rozzy

Rozzy

    Canucks Rookie

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,847 posts
  • Joined: 10-August 07

Posted 26 March 2013 - 06:31 PM


Posted Image

Q-----U-----E-----E-----N-----S-----O-----F-----T-----H-----E-----S-----T-----O-----N-----E-----A-----G-----E


#8 M A K A V E L I 96

M A K A V E L I 96

    Canucks Rookie

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,934 posts
  • Joined: 18-April 11

Posted 26 March 2013 - 06:33 PM

Code:

~ # cat test1
#!/bin/ksh
echo enter the first number:
read num1
echo enter the second number:
read num2
for((i=($num1 + ($num1%2)); i < ($num2-3); i+=2)); do printf "%s " $i; done
echo $((i+2))

Test:
~ # ./test1
enter the first number:
1
enter the second number:
13
2 4 6 8 12

Add the logic for checking if the first number is larger. That should be straight forward.
Posted Image

#9 JoeyJoeJoeJr. Shabadoo

JoeyJoeJoeJr. Shabadoo

    Canucks Regular

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,737 posts
  • Joined: 02-September 09

Posted 26 March 2013 - 09:55 PM

Code:

~ # cat test1
#!/bin/ksh
echo enter the first number:
read num1
echo enter the second number:
read num2
for((i=($num1 + ($num1%2)); i < ($num2-3); i+=2)); do printf "%s " $i; done
echo $((i+2))

Test:
~ # ./test1
enter the first number:
1
enter the second number:
13
2 4 6 8 12

Add the logic for checking if the first number is larger. That should be straight forward.


Give a man a fish....
Posted Image

#10 D.Doughty

D.Doughty

    Canucks Third-Line

  • Banned
  • PipPipPipPipPipPipPipPipPipPip
  • 3,013 posts
  • Joined: 04-March 12

Posted 26 March 2013 - 10:06 PM

wtf is a UNIX command

#11 rbochan

rbochan

    Comets Prospect

  • Members
  • PipPipPipPip
  • 109 posts
  • Joined: 26-April 08

Posted 27 March 2013 - 05:38 AM

You should be doing your own damned homework.
...Rob
The American Dream isn't an SUV and a house in the suburbs;
it's Don't Tread On Me.

#12 Heretic

Heretic

    Canucks All-Star

  • Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 18,806 posts
  • Joined: 08-April 07

Posted 27 March 2013 - 07:52 AM

wtf is a UNIX command


A command that runs in UNIX.

That's what I do for a living - I'm an Unix Admin.

McCoy: We were speculating. Is God really out there?
Kirk: Maybe he's not out there, Bones. Maybe he's right here. [points to his heart]

 

cdc-unavailable.jpg


#13 Dogbyte

Dogbyte

    Canucks All-Star

  • Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 16,028 posts
  • Joined: 31-March 07

Posted 27 March 2013 - 08:25 AM

A command that runs in UNIX.

That's what I do for a living - I'm an Unix Admin.


Let the good times roll. :lol:

Canuckslogo160x160.jpg


#14 Zach Parise

Zach Parise

    Canucks First-Line

  • Members
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 6,410 posts
  • Joined: 20-March 09

Posted 27 March 2013 - 10:36 AM

THANKS !

#15 Tortorella's Rant

Tortorella's Rant

    Canucks Star

  • Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 8,622 posts
  • Joined: 11-April 12

Posted 27 March 2013 - 12:46 PM

I'd rather just use Windows. Both have their advantages and disadvantages. I took a Microsoft Server course that also involved Unix/Linux and I'm not a fan of the command operated OS.

Windows is incredibly easy.. Then again that right there is also an issue..
Posted Image




Canucks.com is the official Web site of The Vancouver Canucks. The Vancouver Canucks and Canucks.com are trademarks of The Vancouver Canucks Limited Partnership.  NHL and the word mark and image of the Stanley Cup are registered trademarks and the NHL Shield and NHL Conference logos are trademarks of the National Hockey League. All NHL logos and marks and NHL team logos and marks as well as all other proprietary materials depicted herein are the property of the NHL and the respective NHL teams and may not be reproduced without the prior written consent of NHL Enterprises, L.P.  Copyright © 2009 The Vancouver Canucks Limited Partnership and the National Hockey League.  All Rights Reserved.