LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-06-2003, 09:34 PM   #1
Rameriez
LQ Newbie
 
Registered: Jan 2003
Posts: 6

Rep: Reputation: 0
Writing scripts


i am trying to write a script that lists a range of numbers, problem: FOR nbr IN 1 - 10 gives,
1
-
10

Im trying to get the list of numbers from 1 to 10:
1
2
3
4
5
6
7
8
9
10
Any suggestions much appreciated.
 
Old 01-06-2003, 11:30 PM   #2
crabboy
Senior Member
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,823

Rep: Reputation: 121Reputation: 121
Try this:

Code:
#!/bin/sh

NBR=1

while [ $NBR -le 10 ]; do
   echo $NBR
   NBR=`expr $NBR + 1`
done
 
Old 01-07-2003, 01:01 AM   #3
Rameriez
LQ Newbie
 
Registered: Jan 2003
Posts: 6

Original Poster
Rep: Reputation: 0
Thumbs up

thx
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing Scripts for Linux in Windows AxXium Linux - General 4 07-18-2005 05:01 PM
Difficulties writing shell scripts lostinsyntax Programming 8 05-02-2005 08:42 AM
Writing C++ Shell Scripts MasterKin8T Programming 5 09-29-2003 11:43 AM
help with writing scripts or batches pls Elvampira Linux - General 3 08-07-2003 05:35 AM
Writing Scripts or Batch files? Nicksan Linux - Software 1 06-30-2003 12:49 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:20 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration