elena
0
Q:

echo with new lines bash

echo -e "hello\nworld"
0
# Using echo
echo -e "Line 1\nLine 2"
echo "Line 1 $HOME expanded
Line 2"
echo 'Line 1 $HOME not expanded
Line 2'

# Similar result, using cat
cat <<EOF
Line 1 $HOME expanded
Line 2
EOF
cat <<'EOF'
Line 1 $HOME not expanded
Line 2
EOF
0
echo -e "hello\nworld"
# Output
  /*
   * hello
   * world
   */
0

New to Communities?

Join the community