75 lines
1.6 KiB
Markdown
75 lines
1.6 KiB
Markdown
# 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>]$`
|
|
|
|
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
|
|
|
|
```
|
|
ps
|
|
```
|
|
|
|
lush checks for a function called ps, which in this case, it finds, and executes:
|
|
|
|
```
|
|
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
|
|
```
|
|
|
|
Okay, but what if there was no function?
|
|
You enter
|
|
|
|
```
|
|
count
|
|
```
|
|
|
|
and there's no function called count, but there is a file called count.lua in the current directory:
|
|
|
|
```
|
|
for i = 1, 5 do
|
|
print(i)
|
|
end
|
|
```
|
|
|
|
lush will look for the function, not find it, see the file, and try to execute it:
|
|
|
|
```
|
|
1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
```
|
|
|
|
And last, if you enter the Lua code:
|
|
|
|
```
|
|
for i = 1, 5 do print(i) end
|
|
```
|
|
|
|
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
|
|
```
|