Skip to main content
FW version: Stable

Script detach

Script detach is a feature that allows script to run in the background. In this case, the script is not blocking the input of the Shell, the Shell is able to accept and execute commands from standard input and simultaneously execute commands of the script, that is already saved in the memory of the yOS device.

To activate this feature, the script, which should run as a detached script has to have the& character (ampersand) right after the main code block ends. Then, this script is loaded to the memory of the yOS device line by line as a usual script. The character & (ampersand) instructs the Shell to run this script in the background and accepts commands from standard input even if the detached script is still running.

Example

This example counts from 60 to 0 over 60 seconds. During this time, the script is running in the background and the Shell is able to accept and execute commands from standard input.


var a
set a 60

{
if a {
echo $a
set a a-1

delay 1000
branch s-
}

echo This is the end
} &