Escapes

If you try to use a command that is not built in to marcel, then marcel will see if there is an executable of the same name. For example, there is no cat operator in marcel, but there is a useful Linux operator by that name, so this works:

If you want to be explicit about using an executable (and not an operator), you can use the bash operator. So, for example, if you really want to use the host operating system's pwd command, instead of marcel's pwd operator, you can do so as follows:

Mixing host executables and marcel operators in the same pipeline works well. At the boundary between the two, strings are passed. Between marcel operators, Python values are passed.

For example, this command, which combines operators and executables, lists the usernames of users whose shell is /bin/bash. map and select are marcel operators, while cat, xargs and echo are Linux executables.

  • cat /etc/passwd: Obtain the contents of the file. Lines are piped to subsequent commands.

  • map (line: line.split(':')): Split the lines at the : separators, yielding 7-tuples.

  • select (*line: line[-1] == '/bin/bash'): select those lines in which the last field is /bin/bash.

  • map (*line: line[0]): Keep the username field of each input tuple.

  • xargs echo: Combine the incoming usernames into a single line, which is printed to stdout.


Another kind of escape is the sudo operator. It works very much like the host operating system's sudo command, allowing you to execute some commands that you would otherwise not be permitted to execute. You configure marcel's sudo in the same way as that of the host OS, (e.g. editing /etc/sudoers). One difference is that marcel's sudo operator takes a pipeline argument, instead of a host OS command. For example, to examine root's .ssh directory:

  • github
  • Twitter
  • email