Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
I don't think I'm understanding the question properly, because
the answer of "don't muck with IFS, just quote the space" seems
to be too trivial:
"this tries to invoke an executable with spaces in its name" \
"and this is an argument which contains spaces"
--Ken Pizzini
you are correct in that you did not completely understand the question.
The problem is that there can *not* be any explicit whitespace
characters in the string. So "this is a string with spaces" won't
work. something like "cd`something`somedir" where `something` returns
a space (or tab) but not a newline, is what I am looking for.
jafo
In article <slrn7qfgk...@pulsar.halcyon.com>,
>The problem is that there can *not* be any explicit whitespace
>characters in the string. So "this is a string with spaces" won't
>work. something like "cd`something`somedir" where `something` returns
>a space (or tab) but not a newline, is what I am looking for.
So you mean something like:
bash -c 'IFS=,;cmd=ls,-l;$cmd'
?
If that's a valid answer then I'll point out that you were
extremely close, you just failed to note that there is no need
to export the IFS.
--Ken Pizzini
jafo...@my-deja.com writes:
>given that you can pass an almost arbitrary string to bash,
>(no white space or slashes) and there are no nice utilities
>like sed, ed, cut, perl, etc., but awk and tcl are in the
>search path, the puzzle is how to construct a command string
>that has a space in it (e.g. a command with parameters).
>changing IFS almost works, except for the trivial detail of
>needing to "export IFS" which has a space in it. I've played
>a bit with trying to pass characters as octal values, but no
>joy so far.
Hm, why not:
echo${IFS}foo
No spaces, but executes "echo foo".
What do I win?
Casper
--
Expressed in this posting are my opinions. They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.
On Wed, 4 Aug 1999 jafo...@my-deja.com wrote:
> Ken,
>
> you are correct in that you did not completely understand the question.
> The problem is that there can *not* be any explicit whitespace
> characters in the string. So "this is a st ring with spaces" won't
> work. something like "cd`something`somedir" where `something` returns
> a space (or tab) but not a newline, is what I am looking for.
>
> jafo
What about this\ is\ a\ string\ with\ spaces? I'm positive that you won't
have to do something as ugly as what you're proposing. :)
--
Med venlig hilsen,
James Avery <av...@io.dk>