Skip to main content
golf
Source Link
Ry-
  • 5.4k
  • 1
  • 25
  • 34

zsh, 2920 + 4 = 24

The script needs to be named .txt.

exec<o.txt;mv(mv [io].txt;>i.txt[io]$0;>i$0)<o$0 

or 1714 with parameters:

exec<$2;mv(mv $@;>$1)<$2 

zsh, 29

exec<o.txt;mv [io].txt;>i.txt 

or 17 with parameters:

exec<$2;mv $@;>$1 

zsh, 20 + 4 = 24

The script needs to be named .txt.

(mv [io]$0;>i$0)<o$0 

or 14 with parameters:

(mv $@;>$1)<$2 
stricter behaviour, but taking advantage of renaming
Source Link
Ry-
  • 5.4k
  • 1
  • 25
  • 34

zsh, 2029

<i*>t;<o*>i*;mvexec<o.txt;mv t[io].txt;>i.txt 

or 17 with parameters:

exec<$2;mv o*$@;>$1 

zsh, 20

<i*>t;<o*>i*;mv t o* 

zsh, 29

exec<o.txt;mv [io].txt;>i.txt 

or 17 with parameters:

exec<$2;mv $@;>$1 
Thanks, F. Hauri!
Source Link
Ry-
  • 5.4k
  • 1
  • 25
  • 34

zsh, 2320

<i*>t;<o*>i*;<t>o*;rm<i*>t;<o*>i*;mv t o* 

zsh, 23

<i*>t;<o*>i*;<t>o*;rm t 

zsh, 20

<i*>t;<o*>i*;mv t o* 
Source Link
Ry-
  • 5.4k
  • 1
  • 25
  • 34
Loading