The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Using last parameter within a script? sugarat Shell Programming and Scripting 5 03-22-2009 01:13 AM
Parameter problem in my script Laibro Shell Programming and Scripting 11 06-02-2008 02:51 PM
Pass parameter into script alfredo Shell Programming and Scripting 2 04-08-2008 09:40 PM
passing parameter from Shell-script to Sql-script subodhbansal Shell Programming and Scripting 0 09-21-2007 06:15 AM
Pass Parameter to Another Script rvprod UNIX for Dummies Questions & Answers 4 04-05-2002 12:07 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-13-2007
mahabunta mahabunta is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 45
Parameter to script

Can i pass more than 9 parameters to unix shell script

if yes in script how can I get that parameter

z=${10}

WILL ABOVE STATEMENT GIVES ME VALUE FOR 10TH PARAMETER PASSED
  #2 (permalink)  
Old 02-13-2007
sumeet sumeet is offline
Registered User
  
 

Join Date: Nov 2006
Posts: 33
hi ,

we can supply as many parameters to a script. simplest way is :

PHP Code:
 cat param.sh
#!/bin/ksh
#
a=${1}
b=${2}
c=${3}
d=${4}
e=${5}
f=${6}
g=${7}
h=${8}
i=${9}
j=${10}
echo 
$a
echo $b
echo $j 
run this script after supplying the parameters :

PHP Code:
param.sh 1 2 3 4 5 6 7 8 9 0
1
2

Thanks
Sumeet
  #3 (permalink)  
Old 02-13-2007
sb008 sb008 is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 384
The above only works depending on your ksh version.

What always should work is using the "shiift" command.

# cat ff.sh
#!/usr/bin/ksh

echo $1
echo $2
echo $3
echo $4
echo $5
echo $6
echo $7
echo $8
echo $9
shift 9
echo $1
echo $2
echo $3
echo $4
echo $5
echo $6



# ./ff.sh a b c d e f g h i j k l m n o p
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o


I provided an extra argument ("p") on purpose.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:30 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0