Note: Please go to docs.rightscale.com to access the current RightScale documentation set. Also, feel free to Chat with us!
Home > Guides > Dashboard Users Guide > Design > RightScripts > Actions > Declare an Environment Variable in a RightScript

Declare an Environment Variable in a RightScript

Table of Contents

Objective

To define an environment variable input in a RightScript.

Overview

A RightScript can be parameterized by specifying a number of inputs that need to be provided to the script for its successful operation. 

Proper syntax for declaring standard environment inputs will vary depending on the type of scripting language.

  • Bash
    • $MYINPUT
  • Perl
    • $ENV{‘MYINPUT’}
  • Ruby
    • ENV[‘MYINPUT’]
  • Python
    • environ[‘MYINPUT’]
  • Powershell
    • $env:MYINPUT
      • Because Powershell variable names are not case sensitive, you can use all lower case letters to prevent system environment variables from being identified as user-defined inputs. (e.g. $env:my_sys_input) 

Steps

Go to the Scripts tab of an editable (HEAD) RightScript. 

Based on the language of the script, use the appropriate syntax format for declaring your environment variable.  Remember to provide a helpful description for each environment variable that's identified.  

A few examples are shown below.

Bash

#!/bin/bash -ex
echo "Hello my name is $FIRST_NAME"

Perl

#! /usr/bin/perl
print "Hi my name is $ENV{‘FIRST_NAME’}";

 

Viewing 1 of 1 comments: view all
Only checking for dashboard changes.
Posted 06:37, 13 Aug 2013
Viewing 1 of 1 comments: view all
You must to post a comment.
Last modified
22:33, 16 May 2013

Tags

Classifications

This page has no classifications.

Announcements

None


© 2006-2014 RightScale, Inc. All rights reserved.
RightScale is a registered trademark of RightScale, Inc. All other products and services may be trademarks or servicemarks of their respective owners.