0

all.

In bash's parameter syntax,

  name=val

val does not get pathname-expansion.

How can I put pathname-expanded result to another variable?

$ ls foo*
foo.1
$ A="foo.*"
$ echo $A
foo.1
$ touch foo.2
$ echo $A
foo.1 foo.2

I want to have A retain value "foo.1" after touching foo.2.

Thanks in advance.

4

1 回答 1

2

请改用数组。

A=(foo.*)
touch foo.2
echo "${A[@]}"
于 2013-01-24T01:48:54.107 回答