9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] name=`{cat foo}
@ 2007-05-27  1:49 arisawa
  2007-05-27  2:23 ` Kris Maglione
  0 siblings, 1 reply; 3+ messages in thread
From: arisawa @ 2007-05-27  1:49 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Hello.

I have a problem that I feel difficult to solve.
Assume a filename is in a file "foo"
Then rc script
	name=`{cat foo}
will mostly succeed in copying the filename to "name" but for some  
exceptions.

For example:
	echo 'abc    def' >foo
	name=`{cat foo}
	whatis name
The output result is:
	name=(abc def)

I want to have a shell variable such as:
	name='abc    def'

How to do?

Kenji Arisawa




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] name=`{cat foo}
  2007-05-27  1:49 [9fans] name=`{cat foo} arisawa
@ 2007-05-27  2:23 ` Kris Maglione
  2007-05-27  3:04   ` arisawa
  0 siblings, 1 reply; 3+ messages in thread
From: Kris Maglione @ 2007-05-27  2:23 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 448 bytes --]

On Sun, May 27, 2007 at 10:49:52AM +0900, arisawa@ar.aichi-u.ac.jp wrote:
> I want to have a shell variable such as:
> 	name='abc    def'
>
> How to do?

You could start by reading the paper or the man page.

for 'abc    def':

ifs='
' { name = `{cat foo} }

for 'abc    def
', or 'abc    def' if you'd used 'echo -n':

ifs=() { name = `{cat foo} }

-- 
Kris Maglione

Bad law is more likely to be supplemented than repealed.

[-- Attachment #2: Type: application/pgp-signature, Size: 194 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] name=`{cat foo}
  2007-05-27  2:23 ` Kris Maglione
@ 2007-05-27  3:04   ` arisawa
  0 siblings, 0 replies; 3+ messages in thread
From: arisawa @ 2007-05-27  3:04 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Thanks Kris,
I have forgotten that!

On 2007/05/27, at 11:23, Kris Maglione wrote:

> On Sun, May 27, 2007 at 10:49:52AM +0900, arisawa@ar.aichi-u.ac.jp  
> wrote:
>> I want to have a shell variable such as:
>> 	name='abc    def'
>>
>> How to do?
>
> You could start by reading the paper or the man page.
>
> for 'abc    def':
>
> ifs='
> ' { name = `{cat foo} }
>
> for 'abc    def
> ', or 'abc    def' if you'd used 'echo -n':
>
> ifs=() { name = `{cat foo} }
>
> -- 
> Kris Maglione
>
> Bad law is more likely to be supplemented than repealed.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-05-27  3:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-27  1:49 [9fans] name=`{cat foo} arisawa
2007-05-27  2:23 ` Kris Maglione
2007-05-27  3:04   ` arisawa

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).