How to debug a bash function that returns a value, and how to add newlines to a variable?

前端 未结 3 1799
广开言路
广开言路 2020-12-20 17:04

I\'m in a bash crash course today.

This is a bash function that returns a value, via echo:

#!/bin/bash
get_hello_name() {
  echo \'Hello $1!\'
}
msg=         


        
3条回答
  •  借酒劲吻你
    2020-12-20 17:52

    You might want to call it with a double quote echo "$x" However if you would want to explicitly show what you typed inside, also known as literal expression use a single quote echo '$x'

提交回复
热议问题