Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
NAME
declare - define or print variables

SYNOPSIS
declare [ATTRIBUTE_OPTION...] [-p] [NAME[=VALUE]...]

DESCRIPTION
Declare variables and/or give them attributes. If no NAMEs are given then display the values of variables. The -p option will display the attributes and values of each NAME.
When -p is used with NAME arguments, additional options are ignored. When -p is supplied without NAME arguments, it will display the attributes and values of all variables
having the attributes specified by the additional options. If no other options are supplied with -p, declare will display the attributes and values of all shell variables.

Please refer to the Variables section for the list of pre-set variables.

ATTRIBUTE OPTIONS
-x
Mark NAMEs for export to subsequent commands via the environment.

Using '+' instead of '-' turns off the attribute instead. If both '+' and '-' are specified for the same attribute, that attribute is turned off.

OPTIONS
-p VARIABLE
Prints the value of a variable.

EXAMPLES
Let us first declare a variable using the declare command
Code Block
declare myvar="This is FluidShell"
 
 To change the default prompt in FluidShell, use the below command:
Code Block
declare prompt=$

To enable variable substitution in SQL statements, use the following command:
Code Block
declare sql_variable=1

To declare the number of statements to be kept in memory:
Code Block
declare histsize=250

To declare the number of results declares returned by a query:
Code Block
declare max_rows=100
 
To display the SQL Statements in the console, when queries are executed, use the command:
Code Block
declare options.console.show.sql=true

To display column headers with SQL results:
Code Block
declare options.console.show.columnheaders=true

To declare the SQL results to be displayed as Form Results:
Code Block
declare options.console.show.resultasform=true

To declare the Margin character length with SQL results:
Code Block
declare options.console.show.margincharlength=5

To display warnings with SQL queries:
Code Block
declare options.console.show.warnings=true

To display warnings headers with SQL queries:
Code Block
declare options.console.show.warningheaders=true

NOTES
A variable can be removed using unset command.

SEE ALSO
unset
export