2017-10-11 18:42:38 +11:00
# PsychOS user guide
## Useful key combinations:
`ctrl-shift-c` inside PsychOS will cancel text input or stop certain programs.
`ctrl-shift-r` will soft-reboot the machine, preserving the content of `/tmp` .
## The lush shell
lush is the default shell of PsychOS. It allows executing functions in memory, programs on disk and Lua typed directly into lush, in order of preference.
The default prompt is `[<user>@<hostname> <current directory>]$`
2017-10-14 07:13:52 +11:00
When you enter a command, lush will first check for functions with the given name.
If there's no function with the name, it will check for a files with the name in every directory in the PATH environment variable.
If lush can't find a file with that name, it will try to execute the line as Lua.
So, if one were to enter
2017-10-11 18:42:38 +11:00
```
2017-10-14 07:13:52 +11:00
ps
2017-10-11 18:42:38 +11:00
```
2017-10-14 07:13:52 +11:00
lush checks for a function called ps, which in this case, it finds, and executes:
2017-10-11 18:42:38 +11:00
```
2017-10-14 07:13:52 +11:00
PID User Name
3 superu logflushd
4 superu ncd
5 superu tty[randomstringabcd]: 8f01b7c7,89734f0
6 superu kbd: 1f46ed58
7 superu kbd-clibboard: 1f46ed58
8 superu login manager: randomstringabcd
2017-10-11 18:42:38 +11:00
```
2017-10-14 07:13:52 +11:00
Okay, but what if there was no function?
You enter
2017-10-11 18:42:38 +11:00
2017-10-14 07:13:52 +11:00
```
count
```
2017-10-11 18:42:38 +11:00
2017-10-14 07:13:52 +11:00
and there's no function called count, but there is a file called count.lua in the current directory:
2017-10-11 18:42:38 +11:00
```
for i = 1, 5 do
print(i)
end
```
2017-10-14 07:13:52 +11:00
lush will look for the function, not find it, see the file, and try to execute it:
2017-10-11 18:42:38 +11:00
```
2017-10-14 07:13:52 +11:00
1
2
3
4
2017-10-11 18:42:38 +11:00
5
```
2017-10-14 07:13:52 +11:00
And last, if you enter the Lua code:
2017-10-11 18:42:38 +11:00
```
2017-10-14 07:13:52 +11:00
for i = 1, 5 do print(i) end
2017-10-11 18:42:38 +11:00
```
2017-10-14 07:13:52 +11:00
lush will look for a function called for and not find it (magic is involved to make this sane), a file named for or for.lua, not find it, then fall back to executing Lua:
```
1
2
3
4
5
```