Skip to content
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

interp: support all Bourne shell (POSIX) builtins #97

Open
mvdan opened this issue May 4, 2017 · 6 comments
Open

interp: support all Bourne shell (POSIX) builtins #97

mvdan opened this issue May 4, 2017 · 6 comments

Comments

@mvdan
Copy link
Owner

mvdan commented May 4, 2017

As described in https://www.gnu.org/software/bash/manual/html_node/Bourne-Shell-Builtins.html. We have most of them already.

mvdan added a commit that referenced this issue May 30, 2017
Initial version, started off from a fairly modified copy of
syntax's code that parses [[ expressions. From that, we had to remove
handling of some tokens like (, &&, and =~. Also had to rework the logic
a bit to merge p.tok into p.val, since we only have strings here.

Need to add more tests for parse errors.

Updates #97.
mvdan added a commit that referenced this issue Jun 18, 2017
mvdan added a commit that referenced this issue Sep 16, 2017
@mvdan
Copy link
Owner Author

mvdan commented Nov 5, 2017

In the past week:

  • added more missing test operators
  • added command
  • added the dir stack ones - dirs, pushd and popd

mvdan added a commit that referenced this issue Nov 6, 2017
@mvdan
Copy link
Owner Author

mvdan commented Dec 29, 2017

Only times, trap, and umask remain.

@masaeedu
Copy link

masaeedu commented Feb 6, 2018

Not sure why it's not on the linked page, but there's also https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html

@mvdan
Copy link
Owner Author

mvdan commented Feb 6, 2018

@masaeedu not listed because shopt is bash, not sh (i.e. not POSIX shell or bourne shell).

The interpreter does support some bash builtins, but there is no ticket for supporting all of them. I might open one once this one is closed, but I don't expect I'll have the patience to implement all of those myself.

@sheldonhull
Copy link

I'm sorry if this is already answered, but I've spent a few minutes digging through issues, discussions, and the Go package and can't find a list of what utilities are matched.
Is there something in the Go package I can look at to match commands?

Specifically I had issues in the past with mkdir on windows, and not sure how to create a cross platform "create a directory" command with sh. Sorry if I missed the docs so let me know where to look if you don't mind! Thanks again! 👋

@mvdan
Copy link
Owner Author

mvdan commented Sep 13, 2022

Note that mkdir is a coreutil, not a shell builtin:

$ echo $0
/bin/bash
$ command -v mkdir
/usr/bin/mkdir

The issue tracking native support for coreutils is #93. It somewhat stalled as it's a huge amount of work, so instead I wanted to leverage an existing coreutils implementation. If someone wants to take a look at reusing u-root as explained in #93 (comment), I would be happy to review a PR :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants