You could use printf
instead:
printf "hello\nworld\n"
printf
has more consistent behavior than echo
. The behavior of echo
varies greatly between different versions.
More Related Contents:
- echo “#!” fails — “event not found”
- ‘\r’: command not found – .bashrc / .bash_profile [duplicate]
- How can I repeat a character in Bash?
- Why can’t I specify an environment variable and echo it in the same command line?
- How can I suppress all output from a command using Bash?
- How to avoid bash command substitution to remove the newline character?
- How to use shell commands in Makefile
- Bash: Strip trailing linebreak from output
- How can I align the columns of tables in Bash?
- How does one output bold text in Bash?
- Bash script – “/bin/bash^M: bad interpreter: No such file or directory” [duplicate]
- How to bold one output text in Bash?
- How to give a pattern for new line in grep?
- How to use `while read` (Bash) to read the last line in a file if there’s no newline at the end of the file?
- Why do you need ./ (dot-slash) before executable or script name to run it in bash?
- What are the special dollar sign shell variables?
- How to loop over files in directory and change path and add suffix to filename
- What is the benefit of using $() instead of backticks in shell scripts? [duplicate]
- How do I use floating-point arithmetic in bash?
- How to suppress Terminated message after killing in bash?
- Delete all lines beginning with a # from a file
- Copy folder recursively, excluding some folders
- Building R Packages using Alternate GCC
- Running programs in parallel using xargs
- How do I check if a directory exists or not in a Bash shell script?
- bash “if [ false ];” returns true instead of false — why?
- Using conditional statements inside ‘expect’
- Reading lines from two files in one while loop
- How do I kill a backgrounded/detached ssh session?
- Creating tar file and naming by current date