- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: ksh oddity - already known?
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
Discussions
Discussions
Forums
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
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
тАО06-06-2006 11:00 PM
тАО06-06-2006 11:00 PM
In a spare shell, try:
$ set -A x a b c d
$ set | grep '^x\['
x[0]=a
x[1]=b
x[2]=c
x[3]=d
$ set | awk '/^x\[/ { print }'
x[0]=a
x[1]=b
x[2]=c
x[3]=d
4$ set | awk -F= '/^x\[/ { $2 = "\"" $2 "\""; print $1 "=" $2}'
x[0]="a"
x[1]="b"
x[2]="c"
x[3]="d"
$ y="$(set | awk -F= '/^x\[/ { $2 = "\"" $2 "\""; print $1 "=" $2}')"
$ echo "$y"
x[0]="a"
x[1]="b"
x[2]="c"
x[3]="d"
$ set | grep '^x\['
x[0]=a
x[1]=b
x[2]=c
x[3]=d
x[1]="b"
x[2]="c"
x[3]="d"
Unsetting does not remove the 'extra' values. It's not '"' specific; try it with text chars.
This may be known already, but I havn't heard of it.
$Revision: @(#) all CUP11.11_BL2002_1129_1 PATCH_11.11 PHCO_27019
Fri Nov 29 08:52:39 PST 2002 $
$ B.11.11_LR Feb 8 2002 01:58:34 $
Version 11/16/88
David
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-06-2006 11:09 PM
тАО06-06-2006 11:09 PM
Re: ksh oddity - already known?
Try installing the latest ksh patch PHCO_33169
http://www4.itrc.hp.com/service/patch/patchDetail.do?patchid=PHCO_33169&sel={hpux:11.11,}&BC=main|search|
Regards,
Robert-Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-07-2006 01:01 AM
тАО06-07-2006 01:01 AM
Re: ksh oddity - already known?
Downloaded patch and installed.
Now at
$ B.11.11_LR Nov 4 2004 06:32:21 $
Version 11/16/88
but it still happens.
Seem to have some problems with -o vi mode command line edits now as well.
David
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-07-2006 03:05 AM
тАО06-07-2006 03:05 AM
Solutionthere is nothing wrong with ksh.
Your grep just gets the data of the value of variable $y as well:
print "$y"
x[0]="a"
x[1]="b"
x[2]="c"
x[3]="d"
To get all array elements of x, enter
print "${x[*]}"
a
b
c
d
You may even get more lines of output in setting
set yy='
x[0]="more"'
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-07-2006 08:55 PM
тАО06-07-2006 08:55 PM
Re: ksh oddity - already known?
Of course.
Thanks,
David
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-07-2006 09:06 PM
тАО06-07-2006 09:06 PM