# What does --shell-escape do?

I stumbled upon an example, which needed to be compiled with the additional option --shell-escape. Using this option it worked just fine, but I'm curious:

Why or when is this option needed and what does it actually do?

-
If I'm not wrong I believe that this option enables TeX to execute other commands during the process. See tex.stackexchange.com/q/76105/14757 –  Sigur Dec 31 '12 at 10:38
Have you checked What are \immediate & \write18 and how does one use them?? In short: “No \write18 without --shell-escape (minus a few safe exceptions).” –  Qrrbrbirlbel Dec 31 '12 at 10:42
Additional note: -shell-escape or --shell-escape for TeXLive or -enable-write18 or --enable-write18 for MikTeX does the same thing. –  Who is crazy first Jan 4 '13 at 1:10
I disagree with the suggested closure. None of the linked threads mentions --shell-escape is such way that it would be obvious to non-experienced users. –  tohecz Jan 4 '13 at 11:46

Sometimes, it is useful to be able to run external commands from inside the tex file : it allows for example to externalize some typesetting, or to use external tools like bibtex. This is available via the \write18 tex primitive.
If an user needs to use it, he needs to explicitely tell the compiler that he trusts the author of the file with shell interaction, and that's exactly the point of the optional --shell-escape argument.