# Are we allowed to submit an answer which executes a shell command?

Many programming languages support a function which executes a shell command. C has system(), Python has os.system(), and there is a whole list on Rosetta Code. And although I haven't seen many examples of people exploiting this on CGCC, there are cases where it saves some bytes. For example in Simple cat program, there is a 21-byte C solution: main(){system("dd");}, which is shorter than any of the C solutions I've seen.

So is this allowed? Or should it be considered a standard loophole?

## It is fine, but ...

... most people don't do it.

A programming language is defined by its implementation so if the implementation has a way of calling shell commands then the language does. In terms of our existing policy these are clearly already allowed.

This is also, in my opinion, the most sensible policy. We can already see that there is not a huge flood answers using this trick. When left to their own devices members of our site choose not to do this most of the time. So I don't see any benefit in banning it. And if we did ban it we would get into the usual fuzzy edge case deliberation and the definition of what really constitutes this trick would have to be complex. A lot of worth for no or negative gain.

So why don't users do this already?

Well here I have to speculate, but I think it has to do with out site culture. We really value the cleverness or skill of the golf perhaps more than we actually value short code. I golf in Haskell because I like Haskell and I want to golf in Haskell.

Using the shell and a generic wrapper defeats this purpose, I might as well just golf in the shell anyway.

I think that it not being very fun to do is a strong enough incentive structure for us.

• "I might as well just golf in the shell anyway." This is one thing, and the other is that it isn't much golfier than using the language's core features in most cases. (And most esolangs don't have access to shell anyway.) – Bubbler Apr 14 at 1:06

## Yes, but...

The downside is your submission is no longer "C" but "C/Bash/Linux", which is less interesting.

## Definitely Yes

If executing a system command allows you to make your code shorter, than go ahead and do it: who has the right stop you from making your code shorter using a clever trick nobody has ever used before?

Executing shell commands is not necessarily "less interesting", because if the executed command is interesting, your answer becomes interesting as well.

It's quite hard to define the threshold for a loophole for this, since all languages internally perform method calls to machine code. Since machine code calls aren't banned, it would be pointless to also have shell script calls banned.