Difference between revisions of "Shell Commands/Setenv"

From MorphOS Library

< Shell Commands

(Created page with "'''SetEnv''' - Creates or modifies specified global environment variable NAME, SAVE/S, STRING/F <nowiki> NAME - Name of the variable to create or modify...")
 
(No difference)

Latest revision as of 14:15, 3 March 2015

SetEnv - Creates or modifies specified global environment variable

NAME, SAVE/S, STRING/F

NAME   - Name of the variable to create or modify                              
SAVE   - Variable will be available after a reboot
STRING - String to attach to the variable

Environment variables are called by scripts or other commands by including a dollar sign ($) in front of the variable name. To remove a global variable definition, use the UnSetEnv command.

Example:

  MorphOS:> SetEnv MOS "MorphOS RULEZ !"
  MorphOS:> Echo "$MOS"
  MorphOS Rulez !

NOTE: Use SetEnv without arguments to display a list of current global variables.

NOTE2: If a global and a local variable share the same name, the local variable is used.