diff --git a/Scripting.md b/Scripting.md index 5657383..37e89f6 100644 --- a/Scripting.md +++ b/Scripting.md @@ -12,7 +12,7 @@ To run a script that's not present in this folder, it can be manually executed b ### Basics -GodMode9 scripts resemble shell scripts. Comments are denoted by `#` and work anywhere. Variable are in the format `$[VAR]` where `VAR` is the name of the variable. (i.e. $[HAX]). Surround an argument with `"` if it must contain whitespaces. Any redundant whitespaces outside of `"` will be treated as a single whitespace. +GodMode9 scripts resemble shell scripts. Comments are denoted by `#` and work anywhere. Variable are in the format `$[VAR]` where `VAR` is the name of the variable. (i.e. `$[HAX]`). Surround an argument with `"` if it must contain whitespaces. Any redundant whitespaces outside of `"` will be treated as a single whitespace. An unknown command will lead to a script abort. #### Wildcards @@ -26,7 +26,7 @@ Example: `ask -o -s "Perform this operation (I will completely ignore your respo ### Commands A short description of every command. Click on the command to go to a more detailed page about it. -`<>` Denotes a required parameter. `[]` denotes an optional parameter. +`<>` Denotes a required parameter. `[]` denotes an optional parameter. A `|` in a parameter means that you must choose one of the options on either side of it. [**echo** command](/d0k3/GodMode9/wiki/Scripting:--echo) - Outputs data to the screen. Syntax: `echo ""` Example: `echo "Hello There!"` @@ -50,6 +50,20 @@ A short description of every command. Click on the command to go to a more detai **fdummy** command - creates a dummy file at the specified location of a specified size. Existing files will not be overwritten. Syntax: `fdummy ` Example: `fdummy 0:/testfile.bin FF` (FF is 256 in regular numbers) +**cp** command - copies a file or directory to another place. `-h` creates a .sha file with the same name containing the file's SHA-256 (only on SD card). `-w` forces overwrite of existing files (rather than a prompt allowing the user to choose). `-k` is the same as `-w` but forces a skip. `-n` prevents canceling the operation (useful for critical operations). Syntax: `cp ` Example: `cp -h -n S:/nand_minsize.bin 0:/gm9/out/NAND_backup.bin` + +**rm** command - removes files and directories recursively. Syntax: `rm ` Example: `rm 9:/*` + +**mv** command - used to move and/or rename files. Same switches as `cp`, except for `-h`. Syntax: `mv ` Example: `imgmount 1:/dbs/ticket.db` + +**imgumount** command - unmounts the currently mounted image. No parameters. + +**sha** command - checks a file's SHA-256 against the second argument, which can either be a file containing the SHA-256 (`.sha` files created by GM9), or the SHA-256 string in hex. Syntax: `sha ` Example: `sha S:/sector0x96.bin 82F2730D2C2DA3F30165F987FDCCAC5CBAB24B4E5F65C981CD7BE6F438E6D9D3` + +**shaget** command - besides sounding like some a very hairy dog, this command will calculate and store a file's SHA-256 in the second argument, be it a variable or filename. Syntax: `shaget ` Example: `shaget 0:/boot.firm BOOTSHA` + [more to come ofc]