LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 03-27-2002, 07:05 PM   #1
Anthony
LQ Newbie
 
Registered: Mar 2002
Posts: 2

Rep: Reputation: 0
Bash Shell Scripts


How do I write a bash shell script that accepts a positive number as a command line parameter to the script and outputs to a file the numbers from 0 to that positive number?

Any help would be appreciated.
 
Old 03-27-2002, 07:16 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982
ok, i'm 97% sure this is homework, in which case, we are NOT here to do your schoolwork for you, so do NOT read the bit below.
Code:
echo counting to $1
NUM=0
while [ $NUM -le $1 ]
do
echo $NUM
NUM=$(($NUM + 1))
done
hmm, i'm bored...
 
Old 03-29-2002, 04:29 AM   #3
Manish
Member
 
Registered: Feb 2002
Distribution: Debian / Debian-based
Posts: 58

Rep: Reputation: 15
Quote:
Originally posted by acid_kewpie
ok, i'm 97% sure this is homework, in which case, we are NOT here to do your schoolwork for you, so do NOT read the bit below.
lol
 
  


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
bash scripts hoffmanyew Programming 3 08-11-2005 01:27 AM
Scripts failing with #!/bin/bash or other shell on first line rdfoerster Fedora 6 11-16-2004 07:46 PM
Feasibility of a compiler for shell scripts (BASH) mac48bit Linux - Newbie 2 08-16-2004 07:07 PM
Bash Shell Scripting *Integrate two scripts* Soulful93 Programming 1 04-29-2004 05:07 PM
bash shell scripts brisbois Linux - Newbie 3 02-17-2004 09:21 AM

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

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