- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- scripting question
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
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
Community
Resources
Forums
Blogs
- 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-25-2008 09:10 AM
11-25-2008 09:10 AM
scripting question
example
xxxxx.sh -a -o param -h -n "title name" filename
any ideas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2008 09:23 AM
11-25-2008 09:23 AM
Re: scripting question
scripting 101
spaced arguments are automatically put in variables, in the order on the command line left to right.
scriptname parm1 parm2 parm3
echo $1
# shows parm1
etc
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2008 09:35 AM
11-25-2008 09:35 AM
Re: scripting question
MYPARMS="$@"
and later:
echo "parms= $ABC"
Note the prolific use of " marks. The quote marks will preserve embedded spaces. Now asa Steven mentioned, the parameters will be separated with white space so if you put extra spaces (or tabs) between values on the line, they will not be preserverd, but the spaces inside a parameter enclosed with quote marks will be preserved.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2008 09:36 AM
11-25-2008 09:36 AM
Re: scripting question
# cat ./seeargs
#!/usr/bin/sh
echo "----------"
for X in "$@"
do
echo $X
done
echo "----------"
# ./seeargs -a -o param -h -n "title name" filename
----------
-a
-o
param
-h
-n
title name
filename
----------
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2008 10:09 AM
11-25-2008 10:09 AM
Re: scripting question
xxxxx.sh -a -o param -h -n \"title name\" filename
xxxxx.sh -a -o param -h -n '"title name"' filename