[9fans] name=`{cat foo} - Plan9

This is a discussion on [9fans] name=`{cat foo} - Plan9 ; 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 ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: [9fans] name=`{cat foo}

  1. [9fans] name=`{cat foo}

    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



  2. Re: [9fans] name=`{cat foo}

    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.

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v2.0.3 (FreeBSD)

    iD8DBQFGWOu+seQZD8Aui4wRApIuAJ4wk7s/jG9Y5SNT6/PwNJqXyZsP6ACgkNPi
    hrY3KvRs2TlLB48nfvSpmUI=
    =5hHd
    -----END PGP SIGNATURE-----


  3. Re: [9fans] name=`{cat foo}

    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.



+ Reply to Thread