By adding a shebang to the scripts they can be executed directly without
an interactive shell. The shebang also makes vims modeline that only set
the filetype obsolete.
Fix behavior to match ls's when the -d flag but no files or directories
were passed.
Fix bug that the function thinks -d is passed when a long option that
contains a 'd' (as --group-directories-first) is specified and thus
just emulates plain `ls` in that case.