Find the answer to your Linux question:
Results 1 to 2 of 2

Thread: Printing "-n"

Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Printing "-n"


    I want to print "-n" in shell.

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

  2. #2


    I've had a similar issue. This worked for me:
    echo - -n
    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:
    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