- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: ksh and quotes
Operating System - HP-UX
1758847
Members
2838
Online
108876
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
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
тАО07-31-2002 10:18 AM
тАО07-31-2002 10:18 AM
Re: ksh and quotes
What about this code?
abc script
#!/bin/sh
set -x
args=''
num_args=$#
i=1
while [ $i -le $num_args ]
do
arg=`eval echo \\$"$i"`
if $(echo $arg | grep -q ' ');then
args=$args"'$arg' "
else
args=$args"$arg "
fi
i=`expr $i + 1`
done
echo $args
--end of script--
--test run--
# ./abc -s 'a b c'
+ args=
+ num_args=2
+ i=1
+ [ 1 -le 2 ]
+ + eval echo $1
+ echo -s
arg=-s
+ echo -s
+ grep -q
+ args=-s
+ + expr 1 + 1
i=2
+ [ 2 -le 2 ]
+ + eval echo $2
+ echo a b c
arg=a b c
+ grep -q
+ echo a b c
+ args=-s 'a b c'
+ + expr 2 + 1
i=3
+ [ 3 -le 2 ]
+ echo -s 'a b c'
-s 'a b c'
---end of test---
Rich
abc script
#!/bin/sh
set -x
args=''
num_args=$#
i=1
while [ $i -le $num_args ]
do
arg=`eval echo \\$"$i"`
if $(echo $arg | grep -q ' ');then
args=$args"'$arg' "
else
args=$args"$arg "
fi
i=`expr $i + 1`
done
echo $args
--end of script--
--test run--
# ./abc -s 'a b c'
+ args=
+ num_args=2
+ i=1
+ [ 1 -le 2 ]
+ + eval echo $1
+ echo -s
arg=-s
+ echo -s
+ grep -q
+ args=-s
+ + expr 1 + 1
i=2
+ [ 2 -le 2 ]
+ + eval echo $2
+ echo a b c
arg=a b c
+ grep -q
+ echo a b c
+ args=-s 'a b c'
+ + expr 2 + 1
i=3
+ [ 3 -le 2 ]
+ echo -s 'a b c'
-s 'a b c'
---end of test---
Rich
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-31-2002 10:38 AM
тАО07-31-2002 10:38 AM
Re: ksh and quotes
Rich
here is what I got from the script:
[ 5 -le 4 ]
+ /cts/sas612/sas -work /prd/works2 -autoexec /prd/preclinical/pbsyst/ahtest/ahtest.sas -initcmd 'af c=ahtest.ahtest.menu.program'
ERROR: Cannot find batch input file '/prd/home/estewar1/c=ahtest.ahtest.menu.program''.
I just do not see where or why there are 2 quotes
Used your script. It seems to do what I want.
Any other ideas?
here is what I got from the script:
[ 5 -le 4 ]
+ /cts/sas612/sas -work /prd/works2 -autoexec /prd/preclinical/pbsyst/ahtest/ahtest.sas -initcmd 'af c=ahtest.ahtest.menu.program'
ERROR: Cannot find batch input file '/prd/home/estewar1/c=ahtest.ahtest.menu.program''.
I just do not see where or why there are 2 quotes
Used your script. It seems to do what I want.
Any other ideas?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-31-2002 11:16 AM
тАО07-31-2002 11:16 AM
Re: ksh and quotes
Thanks to all,
Sometimes simple eludes us.
In this particular case the parameter that I had to pass (stumbled on it) could be separated by spaces or commas.
I just added the comma between the af and the file name and it does not matter about the quotes.
I will try to award points Friday.
Thanks again.
Sometimes simple eludes us.
In this particular case the parameter that I had to pass (stumbled on it) could be separated by spaces or commas.
I just added the comma between the af and the file name and it does not matter about the quotes.
I will try to award points Friday.
Thanks again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-02-2002 04:05 AM
тАО08-02-2002 04:05 AM
Re: ksh and quotes
assigned points as promised
- « Previous
-
- 1
- 2
- Next »
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