All Forums |
Register |
Login |
Search |
Subscriptions |
My Profile |
Inbox |
Tool Warehouse |
FAQs |
Resources |
Help |
Member List |
Address Book |
Logout |
|
|
porting from AIX's dtksh to Interix's ksh -- input problems
|
Logged in as: Guest |
Users viewing this topic: none |
|
Login |
|
|
porting from AIX's dtksh to Interix's ksh -- input prob... - Mar. 13, '06, 9:57:55 AM
|
|
|
policyvote
Posts: 13
Joined: Jan. 11, '06,
Status: offline
|
I'm porting a complex package of scripts from AIX's dtksh to Interix's ksh. I'm a Windows guy who's only been doing UNIX scripting for a few months, and right now I'm getting a real trial by fire.
At the moment, I'm having a problem getting command line parameters to be read into variables.
In AIX, the syntax was this:
somevar=($@)
This would take all of the command line parameters, and then a function was called that would assin the input to the relevant variables. That statement was causing the script to puke with the error "syntax error: `(' unexpected". Stripping off the perens lets the script run, but the parameters don't get read or handed off to the function. I tried:
somevar=${@}
And that works, but only if I put in just one command parameter (several are required).
I may just have to break down and write a
echo: "enter this param" read var kind of a thing. However, anyone have any suggestions to get this to work cleanly?
Peace
policy
|
|
|
RE: porting from AIX's dtksh to Interix's ksh -- input ... - Mar. 14, '06, 11:23:21 PM
|
|
|
markfunk
Posts: 670
Joined: Mar. 31, '03,
Status: offline
|
Hard to tell with such a small source code snippet.
If "samevar" was defined as "typeset -A somevar"
then this would be an associative array and this statement would
be assigning each of the positional args into the "somevar" array.
You could try:
set -A somevar -- "$@"
|
|
|
RE: porting from AIX's dtksh to Interix's ksh -- input ... - Mar. 15, '06, 5:01:56 PM
|
|
|
policyvote
Posts: 13
Joined: Jan. 11, '06,
Status: offline
|
Thanks for the help!
I'd considered an array, but thought that since the params were getting passed from the command line, I didn't want to have to deal with sanitizing input for the array. However, this process does individual tasks by calling jobs from a main shell process. I know I'll be getting the same input every time from the automatic process, so this should be no problem.
Peace
policy
|
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
|
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts |
|
|
|