Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] Adding text to the beginning of a file



On Sun, 18 Mar 2007, Stephen J. Turnbull wrote:

No, it's only going to seem to work for echo.  Try

touch abc def "ghi jkl"
export IFS=""
for file in `ls`; do ls $file; done

It would probably work fine if you quoted the variable. In pdksh:

    $ touch a b 'c d' "e\nf"
    $ for i in *; do ls -l "$i"; done
    -rw-rw-r--  1 cjs  wheel  0 Mar 25 17:33 a
    -rw-rw-r--  1 cjs  wheel  0 Mar 25 17:33 b
    -rw-rw-r--  1 cjs  wheel  0 Mar 25 17:33 c d
    -rw-rw-r--  1 cjs  wheel  0 Mar 25 17:33 e\nf

Note that the \n is a real newline:

    $ echo e*
    e
    f

cjs
--
Curt Sampson       <cjs@example.com>        +81 90 7737 2974


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links