1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-24 01:15:07 +00:00

Shell: Add a 'setopt' builtin

This builtin sets (and unsets) boolean flags that alter the behaviour of
the shell.
The only flags added are
- inline_exec_keep_empty_segments: Keep empty segments in the result of
  splitting $(...) by $IFS
- verbose: Announce each command before executing it

It should be noted that the (rather extreme) verbosity of the names is
intentional, and will hopefully be alleviated by the next commit :^)
This commit is contained in:
AnotherTest 2020-06-29 06:22:58 +04:30 committed by Andreas Kling
parent d6de2b5828
commit b8d1edb2a2
5 changed files with 66 additions and 3 deletions

View file

@ -356,6 +356,14 @@ RefPtr<Job> Shell::run_command(AST::Command& command)
{
FileDescriptionCollector fds;
if (options.verbose) {
fprintf(stderr, "+ ");
for (auto& arg : command.argv)
fprintf(stderr, "%s ", escape_token(arg).characters());
fprintf(stderr, "\n");
fflush(stderr);
}
// Resolve redirections.
NonnullRefPtrVector<AST::Rewiring> rewirings;
for (auto& redirection : command.redirections) {