![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| compound variable in korn shell | ZINGARO | Shell Programming and Scripting | 0 | 08-30-2007 12:30 PM |
| Finding Occurence of comma in a Variable ( KORN Shell) | DeepakXavier | Shell Programming and Scripting | 2 | 11-14-2005 04:44 AM |
| Compound indirect variable references | tkrussel | UNIX for Advanced & Expert Users | 5 | 08-21-2005 11:03 AM |
| Trying to use 'compound variable' in a script | irina | Shell Programming and Scripting | 1 | 01-29-2004 10:33 PM |
| Trying to use 'compound variable' in a script | neemic | Shell Programming and Scripting | 3 | 01-16-2004 07:07 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
compound variable in korn shell
in a text " Korn Shell Unix programming Manual 3° Edition"
i have found this sintax to declare a compoud variable: variable=( [datetype] fild1 [=value] [datetype] fild1 [=value] ) but this sintax in ksh and sh (HP-UNIX) not work... why?? exist another solution for this type of variable ??? |
|
||||
|
i cut the page.. read this
Compound Variables
The Korn shell also supports compound variables, which are similar to structures or records in other languages, that is a meta-datatype which is a group of related values, each of which can have a different data type. The syntax for declaring compund variables is: compound_variable=( [datatype] field1[=value] . . . [datatype] fieldn[=value] ) For example, we can use a compound variable to manage employee information: $ employee=( typeset name=Allenby integer id=1243 float salary=9000.50 ) The syntax to display the value of a compound variable field is: ${compound_variable.field} Here we access the employee compound variable: $ print $employee ( typeset -E salary=9000.5 name=Allenby typeset -i id=1243 ) $ print ${employee.name} in HP/ksh not work.... and this : $ typeset -AE exchange_rate $ exchange_rate["DM"]=1.7 $ exchange_rate["FF"]=.15 $ exchange_rate["AS"]=.04 To display a list of associative array subscripts: ${!variable[*]} or ${!variable[@]} not work ??? |
|
||||
|
HP's version of ksh (ksh88) does not support compound variables. You will have to do one of these:
1. See if any of these downloads are for you: KornShell Software 2. See if zsh will work for you: ZSH - THE Z SHELL |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|