Updated doc.

This commit is contained in:
Patrick Kloepfer 2019-03-23 20:36:51 -04:00
parent caa3910a16
commit 47702d610c
2 changed files with 431 additions and 0 deletions

308
.Docs/Command Guide.md Normal file
View File

@ -0,0 +1,308 @@
# A2osX Command Guide
This Guide provides information on all the A2osX commands and utilities. This Guide helps you not only learn the purpose of each command but also what options a command supports and what arguments it either supports or requires.
A2osX comes with a nice variety of system, file, network and data utilities or what we refer to as external commands. This just means that each of the following commands or utilities is built as a separate BIN or executable file that runs under A2osX. The source for all of these external commands is readily available, so you can make your own as your needs dictate. Note, that there are some **internal** commands that are build into the shell (the interactive prompt) such CD (change directory) or PWD (print working directory). Those commands are discussed in-depth in the **[Shell Developers Guide](.Docs/Shell%20Developers%20Guide.md).**
## System Commands
You will usually not use these commands, they are more commonly found in A2osX system scripts such as ./ETC/INIT or they are launched by the A2osX Kernel itself. All of these commands are found in ./SBIN/ letting you know they are special system commands.
### GETTY
| Command | Options |
| --- | --- |
| GETTY | -E : Exit upon disconnect |
### INSDRV
| Command |
| ---- |
| INSDRV Driver |
### KCONFIG
| Command |
| ---- |
| KCONFIG |
Kernel Configuration Utility writes to ${ROOT}/A2OSX.KCONFIG.
### LOGIN
| Command |
| ---- |
| INSDRV Driver |
### SH
| Command |
| ---- |
| SH Script |
### INITD
| Command |
| ---- |
| INITD InitLevel |
## BIN,External Shell commands:
### CAT
| Command | Options |
| --- | --- |
| CAT | -A : Show All non printable caracters <br> -N : Number all output lines <br> -S : Suppress repeated empty output lines |
The CAT command is used to display the contents of files stored on any ProDOS volume. While the primary use of this tool is to display the contents of TEXT or TXT files, it can be used to display the contents of other files by using the -A option, which will substitute non-printable characters with readable and displayable values such as [EOF] for End of File (Hex x04) or [LF] for Line Feed (Hex x0A).
### CUT
| Command | Options |
| --- | --- |
| CUT | CUT \<opt\> "line" or CMD\|CUT \<opt\> <br> -H : This help screen <br> -F nn : Output field nn <br> -M nn : Output starting at nn <br> -N nn : Output Ending at nn <br> -S ch : Change default SPACE separator to 'ch' |
### CHGRP
| Command | Options |
| --- | --- |
| CHGRP | In Progress | -C : Continue On Error <br> -R : Recurse subdirectories | - |
### CHMOD
| Command | Options |
| --- | --- |
| CHMOD | In Progress | -C : Continue On Error <br> -R : Recurse subdirectories | - |
### CHOWN
| Command | Options |
| --- | --- |
| CHOWN | In Progress | -C : Continue On Error <br> -R : Recurse subdirectories | - |
### CHTYP
| Command | Options |
| --- | --- |
| CHTYP | Working | -C : Continue On Error <br> -R : Recurse subdirectories | 0.92 |
### CP
| Command | Options |
| --- | --- |
| CP | Working | -C : Continue On Error <br> -Q : Quiet <br> -R : Recurse subdirectories <br> -Y : Dont't Prompt For Override | 0.93 |
### EDIT
| Command | Options |
| --- | --- |
| EDIT | Working | still missing : find/replace | 0.93 |
### FORMAT
| Command | Options |
| --- | --- |
| FORMAT | In Progress | FORMAT \<BLOCKDEV\> [VOLUME.NAME] <br> -L : Low-Level Format *not currently supported <br> -1..9 : Catalog Size (block count) | 0.92 |
### GREP
| Command | Options |
| --- | --- |
| GREP | Working | GREP \<opt\> PATTERN FILE or CMD\|GREP \<opt\> PATTERN <br> -H : This help screen <br> -I : Ignore Case <br> -N : Print line Number | 0.93 |
### KILL
| Command | Options |
| --- | --- |
| KILL | Working | KILL \<signal\> PID <br> -0 : No Signal <br> -1 : SIGQUIT | 0.93 |
### LS
| Command | Options |
| --- | --- |
| LS -A : Print . & .. <br> -C : Single column listing <br> -F : Single column, includes full path <br> -L : long listing with size/date... <br> -R : Recurse subdirectories |
### LSDEV
| Command | Options |
| --- | --- |
| LSDEV | Working | Dump device Drivers
### LSOF
| Command | Options |
| --- | --- |
| LSOF | Working | List Open Files
### MD5
| Command | Options |
| --- | --- |
| MD5 | Working | MD5 \[ -D : String \| file \]
### MEM
| Command | Options |
| --- | --- |
| MEM | Working | Old dump behavior is now MEMDUMP. New MEM command displays MEMSTAT (Main, Aux & Kernel Memory)
### MKDIR
| Command | Options |
| --- | --- |
| MKDIR | Working | Make Directory
### MORE
| Command | Options |
| --- | --- |
| MORE | Working | MORE \<File\> or CMD\|MORE \<opt\> <br> -H : This help screen <br> -N : Number all output lines <br> -P : Page mode, no scroll <br> -S : Process ESC codes
### NSCUTIL
| Command | Options |
| --- | --- |
| NSCUTIL | Working | NSCUTIL DD/MM/YY,hh:mm:ss <br> Tool for setting time in NSC/DL1216E
### MV
| Command | Options |
| --- | --- |
| MV | Working | -C : Continue On Error <br> -Q : Quiet <br> -R : Recurse subdirectories <br> -Y : Dont't Prompt For Override
### PS
| Command | Options |
| --- | --- |
| PS | Working | List Processes
### RM
| Command | Options |
| --- | --- |
| RM | Working | RM \[File/Dir, *,? wildcards allowed\] <br> -C : Continue On Error <br> -Q : Quiet <br> -R : Recurse subdirectories
## Network Tools
###ARP
| Command |
| ----- |
| ARP |
Dump ARP cache, setup a static ARP entry
### DNSINFO
| Command |
| ----- |
| DNSINFO -a option to add host???? |
dump DNS cache, setup a static DNS entry
### HTTPGET
| Command | Options |
| --- | --- |
|HTTPGET <ip\|host> [port]| -U Url <br> -F UrlFile|
### IPCONFIG
| Command | Options |
| --- | --- |
|IPCONFIG |-D : Try to get IP address from DHCP <br> -E : Read ETC files <br> -S : Set/Reset TCPIP configuration (-E, then -D if required) |
### NETSTAT
| Command |
| ----- |
| NETSTAT |
Display socket status
### PING
| Command |
| ----- |
| PING <ip\|host> <br> -1..9 : Ping Count |
### TELNET
| Command |
| ----- |
| TELNET <ip\|host> [port] |
### DHCPCLNT
| Command |
| ----- |
| DHCPCLNT |
### HTTPD
| Command |
| ----- |
| HTTPD |
### TCPIPD
| Command |
| ----- |
| TCPIPD |
ARP,IP,ICMP,UDP & TCP ok
### TELNETD
| Command |
| ----- |
| TELNETD -d [port]??? |
## Developer Tools
While almost every command and program that comes with A2osX can be considered a developer tool, there are a few that are very specifically created to be used for developer. This section discusses those tools.
### ASM
| Command |
| ----- |
| ASM |
S-C MASM based multi CPU assembler
### MEMDUMP
| Command |
| ----- |
| MEMDUMP |
Tool to track memory leak
### RPCDUMP
| Command |
| ----- |
| RPCDUMP |
Tool based on UDP socket API, renamed from RPCINFO <br> RPCDUMP <ip\|host>

View File

@ -0,0 +1,123 @@
# A2osX Shell Developers Guide
One of the most significant parts of A2osX is its shell which can perform both interactive and scripted tasks. With the interactive part of the shell you can perform many common and complex tasks using both built-in (native or internal to shell) and external (BINs or executables) commands. Internal commands include CD (change directory), MD (make directory), DATE, TIME, etc. External commands include CP (copy), RM (remove), CAT (display file contents), TELNET, etc.
It should be noted, that it is possible to create and execute short scripts right on the interactive command line (these are run once and not saved like true scripts). An example
### The A2osX Shell (SH)
### Variables
Variable overflow strings and ints
Ints only no real num it just ignore
The 32-bit int data type can hold integer values in the range of 2,147,483,648 to 2,147,483,647. If you add to or subtract from INTs that would cause a RANGE error, you actually get a result that wraps around the range, so if you add 1 to 2,147,483,647 you will get 2,147,483,648.
Strings can be up to 255 characters in length. Note, like INTs, if you try to store more then 255 chars in a string, you get the same wraparound affect where the first 255 chars are tossed out the string is set to the remaining chars, so if you concatenate 3 strings of 100 chars the resulting string will be the last 45 chars of the 3rd original string.
The Shell
Enteracting with the Shell.
Special Keys
Internal Commands
External Commands
Variables
Special Variables
Scripts
Redirection
## Advanced Display Techniques
VT100 Codes
\f Clear Screen
\b backspace
\n newline
\r return (beginning of line with no new line)
\eM Scroll Screen Down 1 Line
\eD Scroll the Screen Up 1 Line
\ec Clear Screen
\e[05;15H Move cursor to row 5 and col 15
\e[H Move to home position (0,0)
\e[K Clear from cursor to end of line
\e[1K Clear from cursor to beginning of line
\e[2K Clear line
Plus Colors
###Examples
IFTTT Tweet using HTTPGET
where [ exp ] and [ condition ] allow to detail operators....
## Internal Shell commands:
| Name | Status | Comment |
| ---- | ------ | ------- |
| \<value\> | Working | $VAR \| string \| "string with SPACE" \| 123 \| -456 |
| \<expression\> | Working | \<value\> [\<op\> \<value\>] ... |
| \<op\> | Working <br> --- <br> Planned | \+ signed int32 add <br> \- signed int32 sub <br> --- <br> \* <br> div <br> mod |
| \<condition\> | Working |[ -D direxists ] <br> [ -E fileordirexists ] <br> [ -F fileexists ]<br> [ -N $VAR variable is not empty ] <br> [ -Z $VAR variable is empty ] <br> [ string1 = string2 ] <br> [ string1 != string2 ] <br> [ string1 .< string2 ] <br> [ string1 <= string2 ] <br> [ string1 .> string2 ] <br> [ string1 >= string2 ] <br> [ int32 -eq int32 ] <br> [ int32 -ne int32 ] <br> [ int32 -lt int32 ] <br> [ int32 -le int32 ] <br> [ int32 -gt int32 ] <br> [ int32 -ge int32 ] |
| BREAK | Working | Exit CASE of SWITCH |
| CASE | Working | CASE <expression> |
| CD | Working | CD path or relative path |
| DATE | Working | |
| DEFAULT | Working | Default CASE for SWITCH |
| ECHO | Working | \b,\e,\f,\n,\\\ and \\% supported <br> -N : Suppress \r\n |
| ELSE | Working | Optional branch for IF block |
| END | Working | End of SWITCH Statement |
| EXIT | Working | exit script or shell |
| FI | Working | Terminator for IF block |
| FUNC | In Progress | FUNC fonction_name <br> \<body\> <br> END |
| IF | Working | [ \<condition\> ] |
| LOOP | Working | Terminator for WHILE block |
| MD | Working | MD path or relative path <br> Create a directory |
| NOHUP | Working | Start a process with PPID=PS0 (Daemon) |
| PAUSE | Working | Wait until CR |
| POPD | Working | Restore previously saved working directory |
| PUSHD | Working | Save actual working directory <br> PUSHD \<dir\> do also a CD to \<dir\> |
| PWD | Working | Print Working Directory |
| RD | Working | Delete an empty directory |
| READ | Working | -S : no echo (password) <br> -P : "prompt message" |
| REN | Working | Rename a file, directory or volume |
| RETURN | In Progress | Exit function with return code |
| SET | Working | -X : toggle debug mode <br> -C : toggle Control-C break mode |
| SHIFT | Working | Remove $1 from cmd line |
| SLEEP | Working | Wait \<count\> 10th sec |
| SWITCH | Working | SWITCH <expression> |
| TIME | Working | |
| WHILE | Working | [ \<condition\> ] |
## Shell variables:
| Name | Status | Comment |
| ---- | ------ | ------- |
| $0 | Working | Command Full Path |
| $1-$9 | Working | Arg[n] |
| $* | Working | All Args |
| $# | Working | Arg Count |
| $? | Working | Return Code |
| $@ | Working | Parent PID |
| $$ | Working | PID |
| $! | Working | Child PID |
| $UID | Working | PS Owner UID |
| $PWD | Working | Working Directory |
note : '$VAR' does NOT expand Variable
## Shell I/O control/redirection:
| Token | Status | Comment |
| ---- | ------ | ------- |
| . | Working | use same env |
| & | Working | start proc |
| \| | Working | pipe |
| < | Working | StdIn redirection |
| > | Working | StdOut redirection |
| >> | Working | Append StdOut |
| 1>> | Working | |
| 1> | Working | |
| 2>> | Working | StdErr redirection |
| 2> | Working | |