Variants of 将在外，君命有所不受? There seems to be multiple versions of this idiom, with slightly different characters:


  Baidu: 将在外，君命有所不受
  
  汉典: 将在军，君命有所不受


And a big bunch of variants:


将在外，军令有所不受
将在外，军令有所不从
将在外，君令有所不受
将在外，军令有所不为
将在外，军令有所不授


There may be more that I have missed.

So in general, these variants are: 将在[外|军]，[君|军][命|令]有所不[受|从|为|授].

A few variants are documented too (sometimes attributed the same person!):


  春秋·齐·孙武《孙子兵法·变篇》：“城有所不攻，地有所不争，*君命*有所不受。”
  
  《史记·孙子吴起列传》：“ 孙子 曰：‘臣既已受命为将，将在*军*， *君命*有所不受。’遂斩队长二人以徇。”
  
  司马光·宋·《资治通鉴》：“五十七年（癸卯，前258）将在外，*君令*有所不受”
  
  亮曰：“彼本无战心，所以固请者，以示武于其众耳。将在*军*，君命有所不受，苟能制吾，岂千里而请战邪！”（晋书.帝纪第一）
  
  《史记·魏公子列传》：“ 侯生 曰：‘将在外，*主令*有所不受，以便国家。’”



Which ones are correct, which ones are incorrect?
For the variants that are correct, are there subtle differences in their meaning?
It should be 君令有所不受. The whole sentence 将在外，君令有所不受 means: (if) the general is far away (at the battlefield), he does not have to obey all emperor's orders. The deeper meaning is that the general should judge and act according to the real situations at the battlefield and thus doesn't need to obey all the orders.

将在军 means the same as 将在外. 军 there means at war as well. Hence 将在军 is also correct.

君命 is the same as 君令. Both 命 and 令 mean order/command there. Hence both 君命 and 君令 are correct. 军命 is not correct. It does not have the right meaning.

主令 means one's master's order, 主 means master. So it means the same as well.