Re: Multiple variable assignments in ksh
From: Janis Papanagnou (Janis_Papanagnou_at_hotmail.com)
Date: 03/24/05
- Next message: remove_Bill_Wyatt_this: "Re: sed substitution of variable characters"
- Previous message: Kenny McCormack: "Re: renaming files in a loop"
- In reply to: Dan: "Multiple variable assignments in ksh"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 24 Mar 2005 20:05:27 +0100
Dan wrote:
> Is there a way to do multiple variable assignments in ksh on a single
> line? Something like this:
>
> #!/bin/ksh
> (Var1,Var2)=($1,$2)
> echo "Values:\n\t${Var1}\n\t${Var2}\n"
>
> Not a big deal, just wondering.
No that's not possible. The closest is the "compound assignment"
v=( var1=$1 var2=$2 )
where you can access the variables as components of a structure
print - ${v.var1} ${v.var2}
Though ordering is important in this assignment; it's sequential.
Janis
- Next message: remove_Bill_Wyatt_this: "Re: sed substitution of variable characters"
- Previous message: Kenny McCormack: "Re: renaming files in a loop"
- In reply to: Dan: "Multiple variable assignments in ksh"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|