Bset » History » Version 11
Per Amundsen, 02/15/2023 11:07 AM
| 1 | 1 | Per Amundsen | _Added in 1.9.0_ |
|---|---|---|---|
| 2 | |||
| 3 | 9 | Per Amundsen | */bset [-tacz] <&binvar> <N> <asciivalue> [asciivalue ... asciivalue]* |
| 4 | 1 | Per Amundsen | |
| 5 | Sets the <N>th byte in binary variable &binvar to the specified ascii value. |
||
| 6 | |||
| 7 | 5 | Per Amundsen | _If N = -1, the data is added to the end of the variable._ |
| 8 | |||
| 9 | 1 | Per Amundsen | If the &binvar docent exists it is created. |
| 10 | If <N> is larger than the size of &binvar it will be zero filled up to <N> bytes. |
||
| 11 | 2 | Per Amundsen | If you specify multiple "ASCII":http://www.asciitable.com/ values, they are copied to successive positions after byte position N. |
| 12 | 1 | Per Amundsen | |
| 13 | *Switches* |
||
| 14 | |||
| 15 | 11 | Per Amundsen | table(ktable). |
| 16 | |*Switch*|*Description*| |
||
| 17 | | -t | Treat values a plain text. | |
||
| 18 | | -a | Disables UTF-8 encoding of characters in the range 0-255, as long as the text contains no characters > 255. | |
||
| 19 | | -c | Chops the &binvar at the end of the copied bytes. | |
||
| 20 | | -z | Creates new or truncates existing &binvar at zero length. | |
||
| 21 | 1 | Per Amundsen | |
| 22 | 10 | Per Amundsen | *Parameters* |
| 23 | 1 | Per Amundsen | |
| 24 | 11 | Per Amundsen | table(ktable). |
| 25 | |*Parameter*|*Description*| |
||
| 26 | | <&binvar> | The &binvar to modify. | |
||
| 27 | | <N> | The byte to modify. (one based) | |
||
| 28 | | <asciivalue> | The "ASCII":http://www.asciitable.com/ value to insert. | |
||
| 29 | 1 | Per Amundsen | |
| 30 | *Example* |
||
| 31 | |||
| 32 | <pre> |
||
| 33 | alias example { |
||
| 34 | 2 | Per Amundsen | ; Create a binary variable set it to "This is fun!" |
| 35 | 1 | Per Amundsen | bset -t &Example 1 This is fun! |
| 36 | |||
| 37 | 2 | Per Amundsen | ; Print out the content of the variable |
| 38 | 1 | Per Amundsen | echo -a $bvar(&Example, 1-).text |
| 39 | } |
||
| 40 | </pre> |