New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a mechanism for writing safe wrappers to external commands #371

Open
xiaq opened this Issue Jun 28, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@xiaq
Member

xiaq commented Jun 28, 2017

External commands mix options and arguments together, and this is a common source of errors. The following POSIX shell code breaks when there is any file whose name starts with a dash:

for f in *; do
  ls $f
done

The correct way is to always write ls -- $f, but that is cumbersome.

In Elvish options use the special &name=value syntax and are completely from arguments. It should be possible to wrap external commands. For instance, a "safe" version of ls can be used like this

ls &l # passes the "l" option; calls "e:ls -l"
ls -l # lists the "-l" file; calls "e:ls -- -l"
ls &l $x # calls "e:ls -l -- $x"
@ganeshi4u

This comment has been minimized.

ganeshi4u commented Jun 30, 2017

@xiaq i said don't inspire from others -_-

@xiaq xiaq added the comp:lang label Mar 20, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment