Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

RE: Export problem



>
> a normal guy wrote about Export problem:
> :I think this is a bug.  Under HP-UX, the following line reports
> :an error:
> :% export RUN_DATE=`date +%Y%m%e%H%M.%S`
> :zsh: not an identifier: 41211.52
>
> Or maybe you want:
> % export RUN_DATE="`date +%Y%m%e%H%M.%S`"
>
> so that the space provided by %e doesn't cause word splitting.
>

This is a bug. No field splitting should be done in parameter assignment
context. Look is SUS for more detail; in short:

- Word expansions:
. Tilde Expansion . Parameter Expansion . Command Substitution . Arithmetic
Expansion . Field Splitting . Pathname Expansion . Quote Removal

- command line porcessing rules:

1. The words that are recognised as variable assignments or redirections
according to Shell Grammar Rules are saved for processing in steps 3 and 4.

2. The words that are not variable assignments or redirections will be
expanded. If any fields remain following their expansion, the first field
will be considered the command name and remaining fields will be the
arguments for the command.

3. Redirections will be performed as described in Redirection .

4. Each variable assignment will be expanded for tilde expansion, parameter
expansion, command substitution, arithmetic expansion and quote removal
prior to assigning the value.

Please note paragraph 4. It explicitly omits Field Splitting from expansions
done for parameter assignments and redirections.

-andrej




Messages sorted by: Reverse Date, Date, Thread, Author