envvar

standard environment variables 

Miscellaneous Information


SYNOPSIS

export NAME=value

set NAME=value

echo $NAME


DESCRIPTION

When a process is executed, it inherits a set of strings called the environment. It is conventional for these strings to have the form:

NAME=value

The export command built into the MKS KornShell can be used to set the variable NAME into the environment of every child process. The set command built into cmd.exe does the same. The echo command prints the value of environment variable NAME inside the MKS KornShell.

Note:

The shell maintains additional shell variables that are not exported to child processes; because these variables are not passed on, they are not environment variables.

The following environment variables are used throughout PTC MKS Toolkit:

COLUMNS 

If you set this variable to a numeric value, various commands use its value as the width of the output device in columns. This overrides the default.

COMSPEC 

The value of this variable must point to the standard command interpreter (cmd.exe), if you want to use that command interpreter in any way. This variable is called ComSpec under 8.1/2012R2/10/2016/2019/11/2022.

ENV 

The value of this variable is the name of a file of MKS KornShell commands, or else be null. When the MKS KornShell is invoked, the file named by ENV is executed before the MKS KornShell does anything else. Thus your ENV file may contain definitions of aliases, shell functions, and son on that may be used by shell scripts. Note that your ENV file is executed, whether or not the MKS KornShell is invoked as a login shell. This differs from older releases of the MKS KornShell.

HASHBANG 

If this variable is set then the #! feature of the MKS KornShell is enabled.

HOME 

This variable is set by the shell's default startup files. It contains the name of your home directory. Your home directory is the default directory for the cd command built into the MKS KornShell.

LIBGL_ALWAYS_INDIRECT 

disables Direct Rendering for NuTCRACKER Platform X applications. When this environment variable is set, X applications running on the NuTCRACKER Platform always use indirect rendering regardless of the settings for the X Server itself.

LINES 

If you set this variable to a numeric value, various commands use its value as the number of lines available on the output device. This overrides the default.

LOGNAME 

This variable is set by the shell's default startup files. It holds the user name of the current user.

MAILER 

For commands that send mail, this variable points at a mail delivery program. If this variable is not set, then the default mailer, mailx is invoked.

PATH 

This variable is set to a default value when you start the MKS KornShell. Normally, it is also set in your profile file. It lists the directories that are to be searched to find commands, as described in sh.

ROOTDIR 

Because Windows systems have a multi-device file system, it is necessary to provide the location of the standard root directory for system files (for example, /etc/profile.ksh and /tmp). This variable contains a device name and possibly a directory where such files are found.

SHELL 

This variable contains the full path name of the current shell. Note that if SHELL is not defined, all commands that require the full path name of the current shell use the contents of the environment variable COMSPEC.

TERM 

This variable contains the terminal type. When MKS Toolkit is installed, this variable is set to nutc. It should not be changed from this value or some utilities may not work correctly.

TK_ARCHIVE_CHARSET 

Contains the format to be used by cpio, tar, pax, vpax, zip, or unzip when reading and writing file names to an archive. The value must be one of ASCII_ANSI, ASCII_OEM, or UTF-8 (or their equivalents) as described in the File Character Formats section of the unicode reference page.

When this variable is unset or it is set to a value other than those listed earlier, the default OEM character set is used.

TK_ASPI_SUPPORT_OFF 

When this variable is set, MKS Toolkit tape-handling utilities do not use ASPI support if it is present and do not display warning messages if it is not.

TK_CMDSUB_FORMAT 

Contains the format to be used for the output from command substitution in MKS KornShell (the `command_line` and $(command_line) structures) and MKS C Shell (the `command_line` structure). The value must be one of those listed in the File Character Formats section of the unicode reference page.

When TK_CMDSUB_FORMAT is not set, the value of the TK_STDIO_DEFAULT_INPUT_FORMAT environment variable is used as the default format.

When TK_CMDSUB_FORMAT and TK_STDIO_DEFAULT_INPUT_FORMAT are both unset, either ASCII_OEM or ASCII_ANSI is used as the default format, as dictated by the current code page. This provides compatibility with older versions of MKS Toolkit.

TK_DO_NOT_PROCESS_ARG_QUOTING 

When set to a non-zero value, disables additional processing of arguments beyond the standard shell quoting. This lets you pass active quotes to a program without them being escaped and becoming literal quotes.

TK_DO_NOT_RUN_WITH_REG_ASSOCIATIONS 

When set, sh ignores file associations in the registry when determining how to run a file.

TK_DUALCASE_IN_CASE_STATEMENTS 

When set, makes pattern-matching in case statements case-sensitive. By default, TK_DUALCASE_IN_CASE_STATEMENTS is not set, and the setting of DUALCASE determines whether or not pattern-matching in case is case-sensitive.

TK_ECHO_USE_BASH_BEHAVIOR 

When set to a non-zero value, echo accepts the options described in the Options section of the echo reference page. When not set or set to zero, these options are only accepted if you are using the built-in version of echo and the shell is in bash mode.

TK_EOL_IS_NL_ON_OUTPUT 

When set to a non-zero value, then a newline (\n) is written at the end of lines instead of the default combination of a carriage return and newline (\r\n).

TK_ERROR_MESSAGES_IN_ENGLISH 

When set to a non-zero value, the Language ID 0x0409 "English[US]" is used when getting error meesages from the operating system.

Note:

There is no guarantee that the error message returned by the operating system is in English.

TK_FIND_LS_OPTIONS 

Allows the find -ls output to be tailored in a limited number of ways. The output starts out being a little like ls -ld and extra options are available (see ls for more details).

Note:

Not all ls options are available. And only some flags are currently recognized. Flags are entered without minus signs. Thus options such as -X A are not available. Invalid options are ignored without warning. e.g.

TK_FIND_LS_OPTIONS=skhEignocu

will display, number of blocks (s), number of kilobytes blocks (sk), sizes in human readable form (h), inodes (i), omit uid/name (g), numeric users and group ids (n), omit gid/name (o), creation time (c), last access time (u). In reality, inode (i , blocks in k (sk , (omit both uid and gid in numeric form (ngo)), permissions, number of links, number of streams (E), size in human readable form (h), creation time(c - overrides u), and file name - sorted by find's discovery rather than creation date.

TK_GLOB_INSIDE_QUOTES 

When this variable is set and you are running a MKS utility from the cmd.exe command line, globbing is supported inside quotes.

TK_GUI_SUBSYSTEM_NOT_SUPPORTED 

When this variable is set, the ability of MKS Toolkit utilities to launch GUI applications is turned off.

TK_HEREDOC_FORMAT 

Contains the format to be used for here documents. The value must be one of those listed in the File Character Formats section of the unicode reference page.

When TK_HEREDOC_FORMAT and TK_STDIO_DEFAULT_OUTPUT_FORMAT are both unset, here documents are assumed to use ASCII_OEM characters. This provides compatibility with older versions of MKS Toolkit.

When TK_STDIO_DEFAULT_OUTPUT_FORMAT is set to UNICODE_BIG_ENDIAN, UNICODE_LITTLE_ENDIAN, UNICODE, UTF8, or UTF-8 and you are feeding a here document to a non-MKS Toolkit utility that won't understand its format, you should set TK_HEREDOC_FORMAT to ASCII_OEM and export it.

When TK_HEREDOC_FORMAT is unset or TK_STDIO_DEFAULT_OUTPUT_FORMAT is set to ASCII, ASCII_OEM, or ASCII_ANSI and your here document contains non-ASCII (OEM) characters, you should set TK_HEREDOC_FORMAT to UTF8 and export it.

This variable takes precedence over TK_STDIO_DEFAULT_OUTPUT_FORMAT.

TK_HOME_SAME_IN_CHILD 

When this variable is set, the value of the HOME environment variable is unchanged when a new command is launched or when a MKS Toolkit utility starts.

If this variable is not set (the default), all forward slashes (/) in the value of the HOME environment variable are replaced with backslashes (\) when a new command is launched. Additionally, backslashes in the value of HOME are replaced with forward slashes when a MKS Toolkit utility starts. This behavior means that when a non-MKS command is launched, the value of HOME has backslashes as expected. Similarly, when a MKS Toolkit utility is launched, the HOME value is quickly converted to use the expected forward slashes.

TK_NTLINKS_OFF 

MKS Toolkit supports hard links under 8.1/2012R2/10/2016/2019/11/2022 on NTFS file systems. There is a slight loss of performance for this support. If you do not require hard link support then you should set and export the environment variable TK_NTLINKS_OFF to disable this support.

TK_NTSECURITYINFO_LOCAL 

When set, MKS Toolkit uses local security information. This variable overrides TK_NTSECURITYINFO_OFF.

TK_NTSECURITYINFO_OFF 

MKS Toolkit supports 8.1/2012R2/10/2016/2019/11/2022 security information on NTFS file systems. There is a slight loss of performance for this support. If you do not require any security information then you should set and export the environment variable TK_NTSECURITYINFO_OFF to disable this feature.

TK_NTSECURITYINFO_SID_TERSE 

Under 8.1/2012R2/10/2016/2019/11/2022, when using ls with the -l option, files having an associated SID, whose name cannot be determined, display the value of the SID instead. SID values are usually very large. You should set and export the TK_NTSECURITYINFO_SID_TERSE environment variable. This causes all SID values to be shortened by replacing all the subauthority values, except the last one, by the string "-...-".

TK_MISSING_SYMLINK_TARGET_TYPE 

Whan a symbolic link is created using the Win32 API CreateSymbolicLink(), the target type of the link must be known. The PTC MKS Toolkit symlink() api will attempt to discover the target type by looking to see if the target already exists and if it is a file or a directory. It is possible to create a symbolic link to a non existent file or directory. In this case the API has no way to know what the target will be once it is created. TK_MISSING_SYMLINK_TARGET_TYPE may be set to "D" (directory) or "F" (file - which is the default if nothing is set) to help the api so that the link may be created.

TK_MISSING_SYMLINK_TARGET_TYPE affects any utility that can create a symbolic link, including unzip, tar and ln.

TK_MISSING_SYMLINK_TARGET_TYPE has no effect when using the directory only reparse point style of symbolic link that ws available in Windows 2000.

The NuTCRACKER Platform symlink() API has similar issues, but is not afected by TK_MISSING_SYMLINK_TARGET_TYPE - for that see _NutConf().

TK_PATH_CONVERT 

Determines whether or environment variables that are considered to contain path names are displayed in Windows or UNIX format. When this variable is set to UNIX (this value is case-insensitive), such an enivronment variable is displayed in UNIX format; otherwise, it is displayed in Windows format. See the Environment Variables and Paths section of the EUCM reference page for more information.

TK_PATH_SAME_IN_CHILD 

When this environment variable is set, forward slashes in the PATH environment variable of child processes are not converted to backslashes. Normally, all slashes in the PATH of child processes are converted internally to backslashes for compatibility with the Windows ShellExecute() function; however, this conversion can cause problems in other ares. As a result, setiing this variable avoids those other problems but will cause the ShellExecute()function to not work.

This variable is best used when you don't want forward slashes in the PATH of a child process converted and you don't require ShellExecute() to work.

TK_PERL_USE_COMSPEC 

When set, this environment variable causes perl to use the contents of the environment variable COMSPEC as the full path name of the current shell, whether or not the environment variable SHELL is set.

TK_PIPE_BUF_SIZE 

When set, the value of this environment variable is size of the pipe buffer in kilobytes. When this value is less than 5k, a buffer size of 5k is used. When this value is greater than 256k, a buffer size of 256k is used.

The default pipe buffer size on is 32k.

Note:

When using a processor with hyperthreading enabled, you should experiment with different values for this environment variable to see which buffer size results in the best performance when using pipes.

TK_PRE90_CMDLINE_PROCESSING 

When this variable is set and MKS argument passing is not used, executable files (that is, those with .exe extensions) truncate their command lines after the command name.

TK_SH_DISPLAY_COMMANDS_IN_SCRIPTS 

When set, the title bar of the shell's window displays the command line for each non-built-in utility in a shell script as it is executed. When this variable is unset, such command lines are only displayed when the shell is interactive.

TK_SH_GUI_ON 

when set, the GUI features of the MKS KornShell are enabled. When it is not set, the the GUI features are disabled. By default, this variable is set; however, if the shell was started with the -G option, this variable is unset.

TK_SH_RHS_OF_PIPE_IN_CURRENT_SHELL 

When set, the right hand side of a pipe is executed in the current shell. Normally, the right hand side is executed in a subshell.

TK_STDIO_DEFAULT_INPUT_FORMAT 

Sets the default input format for files that don't have the initial multibyte marker. The value must be one of those listed in the File Character Formats section of the unicode reference page.

TK_STDIO_DEFAULT_OUTPUT_FORMAT 

Sets the default output format. Normally the format of the first file read is used as the default output format. The value must be one of those listed in the File Character Formats section of the unicode reference page.

TK_SUFFIXED_SEARCHING_FIRST 

By default, MKS Toolkit utilities first search for a command exactly as typed by the user, and if not found, then search for it using file name extensions as described in the Command Execution section of the sh reference page.

When the TK_SUFFIXED_SEARCHING_FIRST environment variable is set, this process is reversed. The command is first searched for using file name extensions and then, if not found, it is searched for exactly as typed by the user.

Consider the following:

echo "echo search_test" > search_test
echo "echo search_test.ksh" > search_test.ksh
PATH="$PATH;"
unset TK_SUFFIXED_SEARCHING_FIRST
search_test
export TK_SUFFIXED_SEARCHING_FIRST=1
search_test
unset TK_SUFFIXED_SEARCHING_FIRST
search_test

The output from the above is:

search_test
search_test.ksh
search_test
TK_TREAT_UNIXPATH_AS_PATH 

This variable contains a semicolon-separated list of UNIX-style directory names (for example, /usr/bin;/bin). When an MKS Toolkit shell or utility cannot find a command and the directory portion of the command appears in this list, a standard path search is performed for the base file name of the command and the first match found is used instead.

For example, if /usr/bin/ls does not exist on your current drive and TK_TREAT_UNIXPATH_AS_PATH contains /usr/bin, then:

which /usr/bin/ls

returns the first ls found by a path search.

TK_TRUNCATE_TOO_LONG_COMMAND_LINE 

When set, MKS Toolkit command lines are truncated instead of reporting that the command line is too long.

TK_USE_CTRLD_AS_CONSOLE_EOF 

When set, allows the use of CTRL-D as the EOF (end-of-file) character for the MKS KornShell (including sh, bash, ksh and resh) and MKS C Shell as well as for any utility that can accept input from the console.

TK_PATH_CONVERT 

Determines whether or environment variables that are considered to contain path names are displayed in Windows or UNIX format. When this variable is set to UNIX (this value is case-insensitive), such an enivronment variable is displayed in UNIX format; otherwise, it is displayed in Windows format. See the Environment Variables and Paths section of the EUCM reference page for more information.

TK_UNIX_FILESYSTEM 

When this variable is set, the Enhanced UNIX Compatibility Mode is on and the virtual file system is in use. For more information, see the EUCM reference page.

TK_USE_CURRENT_LOCALE 

When set, this environment variable causes months and days of the week to be displayed as defined in the current locale. By default, PTC MKS Toolkit utilities display months and days of the week in English.

TK_WOW64FSREDIR_ON 

When set, this environment variable turns on file system redirection on 64-bit Windows systems.

On 64-bit systems, Windows system files for 64-bit applications are stored in the $WINDIR/System32 directory. To avoid confusion, the system files for 32-bit applications are stored in the $WINDIR/SysWOW64 directory.

When file system redirection is on, both 64-bit and 32-bit applications can find the correct corresponding systems files without explicitly indicating the $WINDIR/System32 or $WINDIR/SysWOW64 directory. However, this means that files in $WINDIR/System32 are effectively invisible to 32-bit applications and files in $WINDIR/SysWOW64 are effectively invisible to 64-bit applications.

When file system redirection is off, both 64-bit and 32-bit applications can access system files in both the $WINDIR/System32 and $WINDIR/SysWOW64 directories; however, the directory must be explicitly specified.

By default, this variable is unset and file system redirection is off.

TMPDIR 

By default, PTC MKS Toolkit commands store temporary files under /tmp. To use a different directory for temporary files, set TMPDIR to the name of the directory you want to use.

TZ 

Commands that print times (and dates) use this variable to determine the time zone. If the TZ variable is left undefined, the operating system's current time zone setting is used. See timezone for details. On Windows, the MKS Toolkit makes use of the built-in timezone support, and you should not set the TZ environment variable.


PORTABILITY

The standard names on Windows systems are a superset of those used by UNIX programs, with COMSPEC (ComSpec under 8.1/2012R2/10/2016/2019/11/2022), ROOTDIR and TK_* being the major additions.


AVAILABILITY

PTC MKS Toolkit for Power Users
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
PTC Windchill Requirements and Validation


SEE ALSO

Commands:
cd, env, ls, sh

Miscellaneous:
EUCM, timezone


PTC MKS Toolkit 10.4 Documentation Build 39.