top of page
Basic usage

As with any other shell, you type in commands at the prompt.  In marcel terminology, an operator is a single command, built in to marcel. For example, the pwd operator prints the current directory (pwd = print working directory, as in Linux):

 

M 0.18.3 jao@loon ~$ pwd
drwxr-xr-x   jao    jao        4096   2023 Oct 26 12:55:30   /home/jao

You can also run host OS executables. Marcel doesn't have a builtin operator named which, but you can run which (on Linux and Mac, at least), because that is an executable in the host operating system.

M 0.18.3 jao@loon ~$ which cc
/usr/bin/cc

In some cases, marcel and the host OS will have operators and commands with the same name. In these cases, the marcel operator serves the same general purpose as the host OS executable, but typically has fewer options, and its behavior has been designed to fit into marcel better. An example of this is ls. For example, notice that ls always produces a detailed listing (like Linux's ls -l):

M 0.18.3 jao@loon ~$ cd ~/git/marcel/marcel/object
M 0.18.3 jao@loon ~/git/marcel/marcel/object$ ls
drwxr-xr-x   jao    jao        4096   2023 Sep 10 12:32:29   .
-rw-r--r--   jao    jao         652   2020 May 10 15:41:11   __init__.py
drwxrwxr-x   jao    jao        4096   2023 Oct 25 17:30:55   __pycache__
-rw-rw-r--   jao    jao        3120   2023 Sep 07 20:53:42   cluster.py
-rw-rw-r--   jao    jao        4793   2023 Oct 25 13:53:07   color.py
-rw-rw-r--   jao    jao        2660   2020 Nov 19 14:12:20   db.py
-rw-r--r--   jao    jao        1436   2022 Nov 29 11:33:51   error.py
-rw-rw-r--   jao    jao        8763   2023 Oct 25 13:53:07   file.py
-rw-r--r--   jao    jao        1707   2020 Aug 11 19:24:19   historyrecord.py
-rw-r--r--   jao    jao        2548   2020 Nov 06 10:28:57   process.py
-rw-r--r--   jao    jao         856   2020 Aug 11 19:24:19   renderable.py

Marcel maintains a set of environment variables. Like many other Linux shells, there are entries for USER (your username), PWD (the current directory), and there are other entries. You can examine the complete environment by running the env operator.

You can also examine one of the variables by enclosing the variable's name in parentheses, e.g.

M 0.18.3 jao@loon ~/git/marcel/marcel/object$ (USER)
jao

In general, parentheses delimit aribtrary Python expressions, so you can also do arithmetic:

M 0.18.3 jao@loon ~/git/marcel/marcel/object$ ((1 + 5 ** (1/2)) / 2)
1.618033988749895

or computations involving other Python types, e.g.

M 0.18.3 jao@loon ~/git/marcel/marcel/object$ ('ab' * 3)
ababab
M 0.18.3 jao@loon ~/git/marcel/marcel/object$ (list(range(5)))
[0, 1, 2, 3, 4]

The history command generates a stream containing the most recent commands you have entered:

M 0.18.3 jao@loon ~/git/marcel/marcel/object$ history 5
  527:  (USER)
  528:  ((1 + 5 ** (1/2)) / 2)
  529:  ('ab' * 3)
  530:  (list(range(5)))
  531:  history 5

You can edit the most recent command by running the edit command.  Or to edit an earlier command, run edit N, where N is the identifier of a command printed by the history operator, (one of the blue numbers above). As in other shells, the value of the EDITOR environment variable can be set to determine the editor to be used for editing commands.

You can also do command-line editing using familiar controls, e.g.

  • Ctrl-A: Go to the beginning of the line.

  • Ctrl-E: Go to the end of the line.

  • Ctrl-W: Delete the previous word.

  • Ctrl-U: Delete everything before the cursor.

  • Ctrl-K: Delete everything starting at the cursor.

  • Ctrl-R: Reverse search command history.

  • Up arrow, Ctrl-P: Recall previous command in history.

  • Down arrow, Ctrl-N: Recall next command in history.


You can also recall previous commands. !! recalls the most recent command, and !N recalls command N.

 

bottom of page