Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

echo prints out -e inside script

Tags:

bash

echo

when I run it in the terminal (bash)

echo -e ."\c"

prints out . and suppresses the newline.

When I run the following script (all the code)

echo -e ."\c"
echo -e ."\c"

it prints out .. and suppresses the newlines.

when I run it inside a script with the shebang (!#/bin/sh), it prints out -e . -e . and suppresses the newline.

Why? and how can I prevent this?

EDIT: I want to prevent the -e's from printing out, so my output should be . .

like image 341
Ritwik Bose Avatar asked Oct 24 '25 10:10

Ritwik Bose


1 Answers

change your script shebang to #!/bin/bash instead of #!/bin/sh and see if it works

like image 150
ghostdog74 Avatar answered Oct 26 '25 02:10

ghostdog74



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!