Starting with version 1.1, SSH Remote features a powerful preprocessor, which enables you to better control the output of your buttons and enables some target device independend features.
Below, you will find a list of preprocessor commands, that you can use in any kind of command (simple, shell or (mainly) script). The preprocessor will process the commands line by line and replace occurences in the exact same order as the commands are presented below. If a command is not recognized, it is not replaced. Empty lines are removed from the output after that.
Order | Command | Replaced by | Remarks |
---|---|---|---|
1 | $PUBLIC_KEY$ | The public rsa key used to connect to the device | Only useful when using key authentification. Otherwise, the command will be replaced by nothing |
2 | $TIME$ | The current Time | The format of the time string is "Tue Jun 22 13:07:00 PDT 1999" |
3 | $RANDOM_INT(max)$ | A random integer number between 0 (inlcusive) and max (exclusive) | max must be an integer number. |
4 | $RANDOM_STRING(size)$ | A random string consisting of size characters (upper and lower case letters, digits and the following special characters: -_ ) | size must be an integer number. |
5 | $SET variable=value$ | Nothing | Sets a preprocessor variable with the name variable to value. Variables set this way are used in the next step in this and the following lines. |
6 | $variable$ | The value of the variable | See step 4. |
7 | $OUTPUT=value$ | Nothing | If at least one of those commands is present, the normal output of the ssh commands will be supressed and instead, value will be displayed. Subsequent uses of this commands, will append to this output. |
8 | $SHARE_TEXT=value$ | Nothing | Opens the share selection and shares value as plain text with the target app. |
9 | $SHARE_FILE=value$ | Nothing | Opens the share selection and shares value as a text file with the target app. |
10 | $PRINT=value$ | Nothing | Prints value via android printing. Printing via android is only supported on android 4.4 and upwards! |
11 | $PRINTDIRECT=value$ | Nothing | Prints value via PrintHand directly without requiring further user actionsPrintHand Premium must be installed for this |
For demonstration purposes, below is a small sample file and the subsequent result after each step of the preprocessor.
$SET pwd=$RANDOM_STRING(5)$$ echo "$pwd$" $OUTPUT=Password $pwd$ has been set.$
After the first step in line 1:
$SET pwd=tX32l$ echo "$pwd$" $OUTPUT=Password $pwd$ has been set.$
After the second step in line 1:
echo "$pwd$" $OUTPUT=Password $pwd$ has been set.$
After line 2:
echo "tX32l" $OUTPUT=Password $pwd$ has been set.$
After the first step in line 3:
echo "tX32l" $OUTPUT=Password tX32l has been set.$
Finally:
echo "tX32l"
The output of this script, if executed will be:
Password tX32l has been set.