Results 1 to 3 of 3

Thread: use echo!!!

  1. #1
    Join Date
    Jul 2008
    Beans
    59

    use echo!!!

    Hi,
    i am trying to create new file using "echo" and write in a new line. what i do is:

    $echo -e 1 \n 2 >> test

    what i get inside test:
    1 n 2
    any hint?

  2. #2
    Join Date
    Jul 2007
    Location
    London
    Beans
    262
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: use echo!!!

    Not all versions of echo permit backslash escape codes.

    Code:
    echo "one line" > file
    echo "new line" >> file

  3. #3
    Join Date
    Apr 2005
    Location
    Massachusetts, USA
    Beans
    1,578
    Distro
    Xubuntu 10.10 Maverick Meerkat

    Re: use echo!!!

    You need to put the expression in quotes to properly evaulated. So change your line to
    Code:
    echo -e "1\n2" > test
    cat test
    Registered Linux User #446796
    Registered Ubuntu User #13489

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •