* Re: Variable with Variable Name
[not found] <Xns99A995AD16037zzappergmailcom@80.91.229.5>
@ 2007-09-13 17:30 ` Stephane Chazelas
2007-09-13 18:17 ` zzapper
0 siblings, 1 reply; 2+ messages in thread
From: Stephane Chazelas @ 2007-09-13 17:30 UTC (permalink / raw)
To: zzapper; +Cc: zsh-users
On Wed, Sep 12, 2007 at 01:43:46PM +0000, zzapper wrote:
> Hi,
>
> function SSS()
> {
> # description : create a set variable with variable name
> $1=`pwd`; # What I want but THIS DOESNT WORK
> echo $1
> }
>
> So if I called this
>
> > SSS fred
>
> Would create a variable fred containing the path of the current directory
[...]
SSS() {
eval "$1=\$PWD"
eval "printf '%s\n' \"$1=\$$1\""
}
Which happens to even be POSIX code.
--
Stéphane
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Variable with Variable Name
2007-09-13 17:30 ` Variable with Variable Name Stephane Chazelas
@ 2007-09-13 18:17 ` zzapper
0 siblings, 0 replies; 2+ messages in thread
From: zzapper @ 2007-09-13 18:17 UTC (permalink / raw)
To: zsh-users
Stephane Chazelas <Stephane_Chazelas@yahoo.fr> wrote in
news:20070913173058.GC5335@sc.homeunix.net:
> SSS() {
> eval "$1=\$PWD"
> eval "printf '%s\n' \"$1=\$$1\""
> }
>
Thanks JWTDO
--
zzapper
http://www.rayninfo.co.uk/vimtips.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-09-13 18:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <Xns99A995AD16037zzappergmailcom@80.91.229.5>
2007-09-13 17:30 ` Variable with Variable Name Stephane Chazelas
2007-09-13 18:17 ` zzapper
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).