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

Executing simple command #80

Closed
23 tasks done
Tracked by #51
magicant opened this issue Sep 1, 2021 · 1 comment
Closed
23 tasks done
Tracked by #51

Executing simple command #80

magicant opened this issue Sep 1, 2021 · 1 comment
Labels
tracker List of subtasks

Comments

@magicant
Copy link
Owner

magicant commented Sep 1, 2021


(*) If the command name contains a slash, the command search is skipped, so the shell has no idea whether the command name actually names an existing executable file. That means redirections and assignments are performed even though the external utility invocation is going to fail later. The behavior for command names not containing a slash should be consistent with that.


Bugs:

@magicant magicant changed the title Simple command Executing simple command Sep 1, 2021
@magicant
Copy link
Owner Author

magicant commented Sep 19, 2021

Road map for implementing redirection

  • < redirection for external utility in simple command
    • Expanding the operand and opening a file
      • System::open
  • Applying redirections to built-ins
    • Temporary redirection context / unwinding of redirection
  • Applying redirections to functions
  • > and other kinds of redirections

What if redirection is overwritten while executing a function or built-in?

exec 3<file1
f() { exec 3<file2; }
f 3<file3
cat <&3
# Many existing shells (bash, dash, ksh, mksh, zsh, and yash) print "file1"
exec 3<file1
eval 'exec 3<file2' 3<file3
cat <&3
# Many existing shells (bash, dash, ksh, mksh, zsh, and yash) print "file1"

@magicant magicant added the tracker List of subtasks label Oct 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tracker List of subtasks
Projects
None yet
Development

No branches or pull requests

1 participant