LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-13-2003, 03:04 AM   #1
eltongeoff
Member
 
Registered: Mar 2003
Posts: 76

Rep: Reputation: 15
some bash shell scripting


hey guys, im trying to write a shell script for bash. here's the basic idea

count=$#

while [ $count -gt 0 ]
do
let input=$#-count+1
echo $input
let count=count-1
done


what i want it to do is just list all the paramaters, ie if i type in

command x y z

i want it to return x y z.

however, wut it does here is return the value of input. in this case i would see 1 2 3. does anyone kno how i can make $input into a positional variable??
 
Old 09-13-2003, 08:50 AM   #2
ranger_nemo
Senior Member
 
Registered: Feb 2003
Location: N'rn WI -- USA
Distribution: Kubuntu 8.04, ClarkConnect 4
Posts: 1,142

Rep: Reputation: 47
Would be easier to do...
Code:
for arg in $@
do
  echo $arg
done
 
Old 10-22-2003, 01:10 PM   #3
thepryme
LQ Newbie
 
Registered: Oct 2003
Posts: 6

Rep: Reputation: 0
cant you just do

echo $*

?
 
  


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
Bash shell scripting Sco Linux - Newbie 1 11-09-2004 11:58 AM
Bash shell scripting question mehesque Programming 2 07-15-2004 10:54 AM
Help with I/O on bash shell scripting Dave6383 Programming 1 06-03-2004 05:24 PM
Bash Shell Scripting Help Tangerine Programming 6 05-06-2003 02:10 PM
BASH Shell scripting help ewarmour Linux - General 8 05-25-2002 07:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:00 PM.

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