Copyright (c) 2012-2016 Hyperion Entertainment and contributors.

Environmental Variables

From AmigaOS Documentation Wiki
Jump to: navigation, search

Environment variables are used in AmigaOS within script or batch script processing.

There are both global and local variables, and they are referred to with a dollar sign in front of the variable name, for example $myvar. Global variables are available system-wide; local variables are only valid in the current shell. In case of name collision, local variables have precedence over global variables. Global variables can be set using the command SetEnv, while local variables can be set using the command Set. There are also the commands GetEnv and Get that can be used to print out global and local variables.

Global variables are kept as files in ENV:, and optionally saved on disk in ENVARC: to survive reboot and power cycling. ENVARC: is an assign to SYS:Prefs/Env-archive where SYS: refers to the boot device.

Tip: Surround a variable in curly braces {} to construct a filepath if you are going to use a command such as 'Delete'.