bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: printf -v doesn't allow array assignment


From: Stephane CHAZELAS
Subject: Re: printf -v doesn't allow array assignment
Date: Sat, 18 Jul 2009 18:25:31 +0000 (UTC)
User-agent: slrn/pre1.0.0-11 (Linux)

2009-07-17, 22:02(-04), Chris F.A. Johnson:
>
> $ printf -v q[2] "%s" "$RANDOM"
> bash: printf: `q[2]': not a valid identifier
>
>
>      I know I can work around it with a temporary variable, but it
>      would be nice if it could be done in a single step.
[...]

Just do a "touch q2" before and then it should stop complaining
;-)

Having said that, it's true that if "read 'q[2]'" is allowed, why
not printf -v 'q[2]'.

-- 
St├ęphane


reply via email to

[Prev in Thread] Current Thread [Next in Thread]