LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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, 04: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, 09: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, 02:10 PM   #3
thepryme
LQ Newbie
 
Registered: Oct 2003
Posts: 6

Rep: Reputation: 0
cant you just do

echo $*

?
 
  


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


All times are GMT -5. The time now is 03:27 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration