From my most recent post: (https://stackoverflow.com/questions/15046851/linux-colorizing-text-in-files) I can now colorize text, in my terminal window. (using echo)

Now I'm to the point that I'd like to run a Shell Script that will over-write my /etc/issue whenever I decide to execute my shell script.

Here is my script:

# re-write /etc/issue
echo "Welcome Back!........whatever message I will put later on" > /etc/issue

So now I'm looking to colorize the text "Welcome Back!"

According to This Site, I need to Escape my color codes by using Ctrl+V+ESC But how does one do that inside a shell script, with the goal to re-write the /etc/issue?

I did copy and paste the author's example (rc.issue) that he gives. Indeed, the /etc/issue file gets re-written upon boot, but no color. Just plain text shows.

Can anyone enlighten me on this?


1 Answer 1


One way, which will work in most shells (not just bash) is to make sure the escape appears in the text of the shell script.

If you use vim, then you will still need to type Control-VEscape to enter the escape because otherwise escape changes from insert mode back to command mode.

Other editors may or may not have quirks to make this easier — or harder.

If you're using bash and don't care about portability, then there are other options available, using the \e notation for the escape (see the bash manual on ANSI-C Quoting). For example:


This won't work with all other shells, though.

  • Yep, you're right. I do need to use the same escape method, within vim.
    – coffeemonitor
    Feb 24, 2013 at 0:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .