Gentee
  • Gentee script programming language
  • Language Reference
    • Lexical elements
    • Types
    • Declarations
    • Statements
    • Error handling
    • Expressions
    • Running programs
    • Multithreading
    • Include and import
  • Standard Library Reference
    • Archiving
    • Array
    • Boolean
    • Buffer
    • Characters
    • Console
    • Constants
    • Context
    • Cryptography
    • Encoding
    • Files
    • Float numbers
    • Integer
    • Map
    • Multithreading
    • Network
    • Object
    • Path
    • Process
    • Regular expressions
    • Runtime
    • Sets
    • Strings
    • System
    • Time
  • Go Integration
    • Reference
    • Compilation and execution
    • Advanced features
    • Playground
  • Change language
    • Русский
Powered by GitBook
On this page

Was this helpful?

  1. Language Reference

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}
}
PreviousExpressionsNextMultithreading

Last updated 5 years ago

Was this helpful?