Find the answer to your Linux question:
Results 1 to 2 of 2
Hi, I want to print "-n" in shell. i tried follwoing: echo -n "-n" but it did not work. Please help....
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2011
    Posts
    6

    Printing "-n"


    Hi,

    I want to print "-n" in shell.

    i tried follwoing:
    echo -n "-n"
    but it did not work.
    Please help.

  2. #2
    Just Joined!
    Join Date
    Nov 2006
    Posts
    2

    Solutions

    I've had a similar issue. This worked for me:
    Code:
    echo - -n
    or
    Code:
    echo -n - -n
    depending on what you are trying to do. I don't know why just one dash there works, instead of the usual "dash dash" to end options.

    For greater flexibility you may want to look at printf:
    Code:
    printf "-n"

Posting Permissions

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