LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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, 08: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, 10:30 PM   #2
crabboy
Senior Member
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,821

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, 12:01 AM   #3
Rameriez
LQ Newbie
 
Registered: Jan 2003
Posts: 6

Original Poster
Rep: Reputation: 0
Thumbs up

thx
 
  


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 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 04:01 PM
Difficulties writing shell scripts lostinsyntax Programming 8 05-02-2005 07:42 AM
Writing C++ Shell Scripts MasterKin8T Programming 5 09-29-2003 10:43 AM
help with writing scripts or batches pls Elvampira Linux - General 3 08-07-2003 04:35 AM
Writing Scripts or Batch files? Nicksan Linux - Software 1 06-29-2003 11:49 PM

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

All times are GMT -5. The time now is 10:19 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