Skip to main content
-2
Source Link
roblogic
  • 4k
  • 18
  • 23

Zsh, 2828 26 bytes

for i;<<<$i>$i;ls -S|headS|sed -1q

Try it online!Try it online! 28b

Write each argument (<<<$i) to a file also named (>$i). List directory (ls -S) sorted by size. Take the top result.

This is one byte shorter than aA direct port of the bash solution; is (29 bytes):

for b;(($#b>$#a))&&a=$b;<<<$a

Zsh, 28 bytes

for i;<<<$i>$i;ls -S|head -1

Try it online!

Write each argument (<<<$i) to a file also named (>$i). List directory (ls -S) sorted by size. Take the top result.

This is one byte shorter than a direct port of the bash solution; (29 bytes)

for b;(($#b>$#a))&&a=$b;<<<$a

Zsh, 28 26 bytes

for i;<<<$i>$i;ls -S|sed q

Try it online! 28b

Write each argument (<<<$i) to a file also named (>$i). List directory (ls -S) sorted by size. Take the top result.

A direct port of the bash solution is 29 bytes:

for b;(($#b>$#a))&&a=$b;<<<$a
Source Link
roblogic
  • 4k
  • 18
  • 23

Zsh, 28 bytes

for i;<<<$i>$i;ls -S|head -1

Try it online!

Write each argument (<<<$i) to a file also named (>$i). List directory (ls -S) sorted by size. Take the top result.

This is one byte shorter than a direct port of the bash solution; (29 bytes)

for b;(($#b>$#a))&&a=$b;<<<$a