Skip to content

Latest commit

 

History

History
89 lines (81 loc) · 4.27 KB

README.md

File metadata and controls

89 lines (81 loc) · 4.27 KB

42sh

Features

Aliases

Making up new commands as abbreviations for longer, more complex commands:

  • alias lists all aliases
  • alias name displays the value of this alias
  • alias name [word_list] sets word_list as the value for name
  • unalias [name1, name2...] remove the given aliases. * is supported.

Special aliases supported:

  • precmd runs just before each prompt is printed
  • cwdcmd runs after every change of working directory
History

Invoking previous commands using command history:

  • !! executes the previous command
  • !n executes the nth command that was previously executed
  • !-n executes the command that was executed n commands ago
  • !string executes the most recently executed command that starts with string
  • !?string executes the most recently executed command that contains string
  • history [nb] displays the previous commands (up to nb if specified) with their index and time of execution (hh:mm)
A .42sh_history file is also stored in the user's home folder to have a persistent history between sessions.
Job control
  • fg id brings the specified job into the foreground, where id is the job ID
  • jobs lists all jobs
Line editing
  • and to select a command from the history to edit/execute
  • and to move in the input and edit it
  • CTRL + L to clear the screen
Local environment

Variables specific to the current shell:

  • set var = val creates/updates var with val
  • set var1 var2 ... creates/updates several variables with empty values
  • -r is an option that can be used with set for a read-only variable, which means that you won't be able to use set or unset on it again.
  • unset var1 var2 ... removes the given variables

Preloaded variables:

  • cwd for the current working directory (will be updated when you change directory)
  • euid for the effective user id
  • euser for the effective username
  • gid for the user's group id
  • group for the user's group name
  • history explained below, set to 100 by default
  • home for the user's home directory
  • owd for the old working directory (will be updated when you change directory)
  • uid for the user id
  • user for the username

Special variables supported:

  • ignoreeof to disable EOF shell exit if set to 0 or empty. If set to a number n, the shell will exit on the nth consecutive EOF.
  • history to set a limit of commands display by the builtin of the same name.

Developers


Florian Lauch

Léa Guillemard

Dorian Moy

Reza Rahemtola