- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Input parameters
Operating System - HP-UX
1748202
Members
3008
Online
108759
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-21-2001 10:54 AM
тАО11-21-2001 10:54 AM
Hi Folks,
I need to write a shell script which will take min. 7 input parameters and there is no maximum limit for input parameters. I have to read the parameters 8 and above into one variable. Can some body help me how to read the parameters into one variable. Thanks in adv.
Kris
I need to write a shell script which will take min. 7 input parameters and there is no maximum limit for input parameters. I have to read the parameters 8 and above into one variable. Can some body help me how to read the parameters into one variable. Thanks in adv.
Kris
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-21-2001 11:09 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-21-2001 11:19 AM
тАО11-21-2001 11:19 AM
Re: Input parameters
I agree with Clay, shift will do it. Run a trial throught this script and you get a good output
#!/bin/sh
echo $1
echo $2
echo $3
echo $4
echo $5
echo $6
echo $7
shift 7
echo $*
sh echo.sh a b c d e f g h i j
results...
a
b
c
d
e
f
g
h i j
You can modify from there.
C
#!/bin/sh
echo $1
echo $2
echo $3
echo $4
echo $5
echo $6
echo $7
shift 7
echo $*
sh echo.sh a b c d e f g h i j
results...
a
b
c
d
e
f
g
h i j
You can modify from there.
C
"In theory, there is no difference between theory and practice. But, in practice, there is. " Jan L.A. van de Snepscheut
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-21-2001 11:30 AM
тАО11-21-2001 11:30 AM
Re: Input parameters
Hello Kris,
how about this:
#!/usr/bin/sh
while [ -z "$p7" ]; do
echo "enter data:\c"
read p1 p2 p3 p4 p5 p6 p7 rest
done;
echo "1. word: $p1"
echo "2. word: $p2"
echo "3. word: $p3"
echo "4. word: $p4"
echo "5. word: $p5"
echo "6. word: $p6"
echo "7. word: $p7"
echo "8+ word: $rest"
HTH,
WOdisch
how about this:
#!/usr/bin/sh
while [ -z "$p7" ]; do
echo "enter data:\c"
read p1 p2 p3 p4 p5 p6 p7 rest
done;
echo "1. word: $p1"
echo "2. word: $p2"
echo "3. word: $p3"
echo "4. word: $p4"
echo "5. word: $p5"
echo "6. word: $p6"
echo "7. word: $p7"
echo "8+ word: $rest"
HTH,
WOdisch
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP