archivo

Archivos Mensuales: mayo 2013

echo -e $VAR o echo “$VAR”?

Tech Team

I just found out that by default backslashes are escaped when using the echo command in a bash shell script.

Check the man page for echo for more info.

Here is an example of how to get a new line using echo (by adding a new line character to a variable)

Example 1

words=”first line \n second line.”

echo $words

produces : first line \n second line.

Example 2 (USING THE -e FLAG)

words=”first line \n second line.”

echo -e $words

produces:

first line

second line

Ver la entrada original

Anuncios