Skip to content
Fix Code Error

Echo newline in Bash prints literal n

March 13, 2021 by Code Error
Posted By: Anonymous

In Bash, tried this:

echo -e "hellonworld"

But it doesn’t print a newline, only n. How can I make it print the newline?

I’m using Ubuntu 11.04.

Solution

You could use printf instead:

printf "hellonworldn"

printf has more consistent behavior than echo. The behavior of echo varies greatly between different versions.

Answered By: Anonymous

Related Articles

  • Ubuntu apt-get unable to fetch packages
  • Rails wrong number of arguments error when…
  • Docker not able to install git on Ubuntu container
  • 'block in draw' rails 6 routes
  • Install pip in docker
  • What are the undocumented features and limitations…
  • Getting infinite loop after entering 2 objects to…
  • How to install Maven 3 on Ubuntu…
  • Python is not calling fucntions properly
  • SDL_SetRenderTarget() hangs for a while if multiple…
  • Javascript - How to show escape characters in a string?
  • How can I have a newline in a string in sh?
  • R - do I need to add explicit new line character…
  • Homebrew install specific version of formula?
  • What are the differences and similarities between…
  • Ember build failing
  • OpenCL - Approximation of Pi via Monte Carlo…
  • Pandas how to split vlaues of every column based on colon
  • How do I install Java on Mac OSX allowing version switching?
  • Is the nginx repo the same as the ubuntu 18.04 repo?
  • SSLError: [SSL: EE_KEY_TOO_SMALL] ee key too small…
  • Check number of arguments passed to a Bash script
  • First echo missing when using bash -c over SSH
  • How to run a shell script on a Unix console or Mac terminal?
  • How does PHP 'foreach' actually work?
  • How to get $HOME directory of different user in bash script?
  • Trying to embed newline in a variable in bash
  • How to debug a bash script?
  • What is an optional value in Swift?
  • RegEx match open tags except XHTML self-contained tags
  • How to remove MySQL completely with config and…
  • fork() and wait() with two child processes
  • Unexpected literal in error position of callback in Vue.JS
  • delete item in array of struct that has char array…
  • why static local variable doesn't preserve it's…
  • How to enable named/bind/DNS full logging?
  • Simple logical operators in Bash
  • Why should text files end with a newline?
  • Ubuntu: OpenJDK 8 - Unable to locate package
  • How do SO_REUSEADDR and SO_REUSEPORT differ?
  • Why does declared array size not affect the size of…
  • How to echo with different colors in the Windows…
  • Evaluating a mathematical expression in a string
  • Import Python Script Into Another?
  • How to check which PHP extensions have been…
  • Implementation of user defined array on stack and/or…
  • How to update Python?
  • Replacing a 32-bit loop counter with 64-bit…
  • How to define hash tables in Bash?
  • How do I print colored output to the terminal in Python?
  • Why does C++ code for testing the Collatz conjecture…
  • What is the difference between CMD and ENTRYPOINT in…
  • Change the location of the ~ directory in a Windows…
  • What does this symbol mean in JavaScript?
  • Bash: Echoing a echo command with a variable in bash
  • data.table vs dplyr: can one do something well the…
  • 'int' object has no attribute 'user_list'. (Django…
  • What does "-ne" mean in bash?
  • Mac OS X and multiple Java versions
  • vuex- state returned as function or object literal
  • What's a concise way to check that environment…
  • eval command in Bash and its typical uses
  • How to remove a newline from a string in Bash
  • How do you list volumes in docker containers?
  • Install opencv for Python 3.3
  • How to write an application to control a driver…
  • Configure systemd to manage a service
  • docker command not found even though installed with apt-get
  • bash export command
  • Polymer CLI build runs out of memory
  • shell script. how to extract string using regular…
  • Using %s in C correctly - very basic level
  • Which characters need to be escaped when using Bash?
  • I lose my data when the container exits
  • How do I tell Maven to use the latest version of a…
  • RecursionError: maximum recursion depth exceeded in…
  • Why is my loop stopping at the first argument (char…
  • Macro definition causing error during composition
  • setsimplecolumn doesn't position the text to the…
  • Memcached vs. Redis?
  • Print a matrix of alternating X's and O's given…
  • printf, wprintf, %s, %S, %ls, char* and wchar*:…
  • How to upgrade R in ubuntu?
  • What's the difference between [ and [[ in Bash?
  • How do I use shell variables in an awk script?
  • How to convert a string to lower case in Bash?
  • Exporting awk variables to bash variables?
  • How to tell if a string is not defined in a Bash…
  • How to generate a deterministic set of UUIDs in golang
  • Redirect stderr to stdout in C shell
  • Difference between single and double quotes in Bash
  • PIP Install file not found on Linux Servers
  • How to install Intellij IDEA on Ubuntu?
  • How do I parse command line arguments in Bash?
  • problem with client server unix domain stream…
  • Searching for matching elements between 2 arrays in C
  • Question about memory allocation for literal strings in c
  • How do I connect to a terminal to a serial-to-USB…
  • How to solve Internal Server Error in Next.Js?
  • Is there a way to run Bash scripts on Windows?

Disclaimer: This content is shared under creative common license cc-by-sa 3.0. It is generated from StackExchange Website Network.

Post navigation

Previous Post:

Get the value in an input text box

Next Post:

How to define a two-dimensional array?

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

.net ajax android angular arrays aurelia backbone.js bash c++ css dataframe ember-data ember.js excel git html ios java javascript jquery json laravel linux list mysql next.js node.js pandas php polymer polymer-1.0 python python-3.x r reactjs regex sql sql-server string svelte typescript vue-component vue.js vuejs2 vuetify.js

  • you shouldn’t need to use z-index
  • No column in target database, but getting “The schema update is terminating because data loss might occur”
  • Angular – expected call-signature: ‘changePassword’ to have a typedeftslint(typedef)
  • trying to implement NativeAdFactory imports deprecated method by default in flutter java project
  • What should I use to get an attribute out of my foreign table in Laravel?
© 2022 Fix Code Error