[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problems with ~ and ~~
> > ; a = <={~~ (foo.c foo.x bar.h) *.[ch]}
> > ; echo $a
> > foo c bar h
> >
> > You only assigned a command to a. The <= in front evaluates the
> > command and substitutes the result in the command line.
>
> I don't understand well <= role. Man page says that it is for return
> value of external command. Doesn't make more sense using `{} or eval
> in this case?...
` and <= are very similar. Both evaluate their arguments, and both fill
in values that can be used as command arguments. ` gets its values from
the output of its argument. <= gets its values from the ``return value''
of its argument; the return value of an external command is its exit
status (or exit signal), but the return value of an internal function can
be anything.
It's a fairly messy distinction. I'm very unhappy with it. If Unix
didn't have exit statuses, it would probably never have happened.
Instead, I generalized exit statuses in a way they shouldn't have been.
Making ~~ print its results would probably have been the right thing; it
doesn't, if I remember correctly, because I was concerned about quoting
issues and separators and things like that. If it had just printed its
results, you could have used ` and it would be easier to see results.
--p