Escape Characters are driving me crazy!

Hi everyone,

Is there anywhere I can find a complete table of all characters that must be escaped by the various UNIX shells and scripting languages?

It seems every command/shell/scripting language has different rules about what characters must be escaped.

I do a lot of searching and replacing with files that contain all kinds of characters like ^{}[]()!@#$%&*_+=|\<>.,?~`:";' Did I cover them all?

Can anyone point me to a reference list/table of some kind that I can use. I would love to be able to confidently use sed, awk, perl, ksh or whatever to do string manipulation using these characters without constantly having to guess and experiment with what has to be escaped.

Thanks so much!!

They are called shell metacharacters. As long as you POSIX shells (not csh or tcsh for example) the url below will work for you.

Here is a discussion
Handle Metacharacters

Hi.

This page (badly titled) UNIX Shell Quote has a comparison table of basic metacharacters (and the site has a number of other good tutorials). Newer shells (bash, zsh, ksh) have a more extensive syntax, e.g. for dealing with arrays, string manipulation, etc. For those, you will need to look at man pages, which for shells, are often quite long ... cheers, drl

Thanks! Both links are very helpful!