Last modified: 2021-12-20 10:50

gcs - gc Wrapper

gcs is a simple wrapper script around gc to add the following things to gc:

  1. Delete the temporary file when gc is terminated by a signal.
  2. Add rlwrap to allow command line editing in gc.
  3. Add a session file.

rlwrap and session file computing is only done for interacive session. If standard input is not a tty, gc is started with the signal handler to remove the temporary file. If the first option on the command line is -x gc is started without the handler.

gcs interprets the first command line parameter to construct the location of a session history file. All other options and parameters (and the first too if it is not used for the session file) are passed to gc. A -h option overwrite the session file from gcs.

For now gcs is an optional script around gc. In a future release gc might move to /usr/lib/gc renaming gcs to gc.

Session file

When gcs is started it checks if a command line argument is present and computes the session file from it.

If none of the above rules matches, gcs creates a session file using a named based on the tty and locates that file in either /run/user/id -u or /run which should make the session temporary.