Running programs

The language has a special command $ to run applications and operating system commands with the specified parameters. The script takes the entire line up to the newline character and execute it. There must be a space between the $ and the command line. If this command is used in an expression, it captures the standard output and returns it as a string. Otherwise, the standard output will be visible in the console. You can specify expressions with %{Expression} as in a backquoted string. If any parameter contains a space, enclose that parameter in any quotes - "a b", 'c d', `e f`. If the executable application or command terminates with an error code other than zero, the script will also stop working and return an error.

Command = "$ " { unicode_linechar | "%{" Expression "}" | "${" identifier "}" }
run str {
   $ dir
   str name = $ echo "John Smith"
   return $ echo My name is %{name}
}

Environment Variables

The Gentee language allows you to easily get environment variables and assign values to them. To do this, specify the $ character before the variable name. In addition, you can substitute the environment variables with the ${ENV_NAME} construct in the $ launch commands and back-quoted strings. This entry is shorter than %{ $ENV_NAME }. Environment variables are always of string type, but you can assign them values of str, int, and bool types.

EnvVariable = "$" identifier
run str {
    $MYVAR = `Go path: ${GOPATH}` + $GOROOT
    return $ echo ${MYVAR}
}

Last updated