Created
January 6, 2021 02:46
-
-
Save NateWeiler/4cc16a308facf41ffc03a65abf92fd80 to your computer and use it in GitHub Desktop.
Adding a new line in a shell script examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
echo -e "new line in shell script\n" | |
echo -e "new line using echo\n" | |
echo -e "Similar result, using cat\n" | |
echo -e "hello\nworld\n" | |
echo -e "new line using cat\n" | |
cat <<EOF | |
echo -e "\nnew line using printf\n" | |
printf "hello\nworld" | |
echo -e "\nprintf has more consistent behavior than echo. The behavior of echo varies greatly between different versions." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment