Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am working with a bash script that someone else wrote and I see the following line:


The files with which it's working are all named like:

EXAMPLE.command1.log EXAMPLE.command2.log

Is there any reason for the backslash escaping the dot since a dot isn't treated specially in filename expansions? What are the implications of doing this vs without the backslash as such?:

share|improve this question
Since . is not a character that needs quoting, it looks like the backslash is entirely extraneous. It may be a typo, or the person who wrote that line just felt like adding a backslash? – jw013 Nov 5 '12 at 18:35
I agree that it was likely a typo but it made me curious whether there were any effective differences in the two commands or if the backslash is simply ignored. – Dave Forgac Nov 5 '12 at 18:40
up vote 2 down vote accepted

There is no difference. The dot . is not a special shell character that needs quoting, and the backslash will simply be removed during quote removal. This is true in most shells, not just bash.

share|improve this answer
Thanks, this is the supporting documentation for which I was looking. – Dave Forgac Nov 5 '12 at 18:46

Not an answer to your question that has already been addressed by @jw013, but please note that while the \ and {} are superfluous here, there are a few things missing. Like the variables should be quoted, and -- to mark the end of options is missing.

share|improve this answer
I was going to mention this in a comment but didn't as it was not relevant to the question. However all these adjustments are indeed necessary for maximum robustness. – jw013 Nov 5 '12 at 19:14
@jw013, agreed, but I think it's worth mentioning. The \ is misleading but harmless, the {} is cosmetic and a matter of taste, but the missing quotes or -- are wrong. – Stéphane Chazelas Nov 5 '12 at 23:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.