Unwanted Dollar Sign in Bash Script
The script that I used ran fine for various flavors of Linux for a long time. But somehow, it produced unwanted dollar sign on Ubuntu 18.04, so my hours of troubleshooting starts. The simplest one I can say is I use echo with tab and variables and piped that to awk through AWS Systems Manager. It is similar to the following: v='variable' TAB=$'\t' echo "${v}${TAB}" | awk '{print $0}' In many flavors of Linux other than Ubuntu 18.04, even in Ubuntu 16.04, it produced the expected result: variable However, in Ubuntu 18.04, it ends the result with an extra dollar sign: variable$ At first, I thought it marks end of line or the typical \0 ( NUL character) that marks end of string, so I tried various ways to remove it such as using tr , gsub , etc. But none of them works. Eventually, I found out that the dollar sign comes from the TAB variable. To solve it, I have to replace the above with: echo -e "${v}\t"