The UNIX and Linux Forums  

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 here.

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

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-13-2007
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
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 02-13-2007
Registered User
 

Join Date: Nov 2006
Posts: 23
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
Reply With Quote
  #3 (permalink)  
Old 02-13-2007
Registered User
 

Join Date: Jan 2007
Posts: 366
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.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 03:28 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0