Shell Commands/Quote
From MorphOS Library
Quote - Quotes strings in various ways
RULE/A, FILE/K, VAR/K, STR, NOLINE/S, NOQUOTES/S, FIRSTLINE/S, REVERSE=UNQUOTE/S
RULE - Quoting/encoding rule, see below FILE - Input file VAR - Input variable STR - Input string NOLINE - Doesn't move the cursor to the next line after printing the string NOQUOTES - Doesn't add quotation marks after the final stage of rules FIRSTLINE - Prints only the first line of the output REVERSE - Attempts to parse the quoted input, doesn't work with all rules
RULE is the quoting/encoding rule. One or more of:
READITEM - Argument parsed by ReadItem() / ReadArgs() MATCHPATTERN - Pattern matched with MatchPattern() URI - Percent encoded URI component HEX - Hex encoded content BASE64 - Base64 encoded content AREXX - ARexx string SH - Argument parsed by a shell, such as ksh JS - JavaScript string C - C language string
Any number of rules can be combined, separated by space. The rules will be applied to the input in order. The resulting output will be printed to standard output.
Examples:
Ram Disk:> Quote RULE="MATCHPATTERN READITEM" STR="Work:Pic #1.jpg" "Work:Pic '#1.jpg" Ram Disk:> Quote RULE=URI STR="Work:Pic #1.jpg" Work%3APic%20%231.jpg Ram Disk:> Quote RULE=HEX STR="Work:Pic #1.jpg" 576f726b3a5069632023312e6a7067 Ram Disk:> Quote RULE=BASE64 STR="Work:Pic #1.jpg" V29yazpQaWMgIzEuanBn Ram Disk:> Quote RULE=BASE64 STR="V29yazpQaWMgIzEuanBn" REVERSE Work:Pic #1.jpg Ram Disk:> Quote RULE=URI VAR="DefIcon_Path" SYS%3APrefs%2FPresets%2FDeficons%2F Ram Disk:> Quote RULE=URI FILE="SYS:Prefs/Env-Archive/DefIcon_Path" SYS%3APrefs%2FPresets%2FDeficons%2F