The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

Интерактивная система просмотра системных руководств (man-ов)

 ТемаНаборКатегория 
 
 [Cписок руководств | Печать]

whence (1)
  • >> whence (1) ( Solaris man: Команды и прикладные программы пользовательского уровня )
  •  

    NAME

    typeset, whence - shell built-in functions to set/get attributes and values for shell variables and functions
     
    

    SYNOPSIS

    typeset [± HLRZfilrtux [n]] [name[=value]]...
    

    whence [-pv] name...
    

     

    ksh93

    ++typeset [±AHflbnprtux] [±EFLRZi[n]] [vname[=value]]
    

    whence [-afpv] name...
    

     

    DESCRIPTION

     

    ksh

    typeset sets attributes and values for shell variables and functions. When typeset is invoked inside a function, a new instance of the variables name is created. The variables value and type are restored when the function completes. The following list of attributes can be specified:

    -f

    The names refer to function names rather than variable names. No assignments can be made and the only other valid flags are -t, -u and -x. The flag -t turns on execution tracing for this function. The flag -u causes this function to be marked undefined. The FPATH variable is searched to find the function definition when the function is referenced. The flag -x allows the function definition to remain in effect across shell procedures invoked by name.

    -H

    This flag provides UNIX to hostname file mapping on non-UNIX machines.

    -i

    Parameter is an integer. This makes arithmetic faster. If n is non-zero it defines the output arithmetic base; otherwise, the first assignment determines the output base.

    -l

    All uppercase characters are converted to lowercase. The uppercase flag, -u is turned off.

    -L

    Left justify and remove leading blanks from value. If n is non-zero it defines the width of the field; otherwise, it is determined by the width of the value of first assignment. When the variable is assigned to, it is filled on the right with blanks or truncated, if necessary, to fit into the field. Leading zeros are removed if the -Z flag is also set. The -R flag is turned off.

    -r

    The specified names are marked readonly and these names cannot be changed by subsequent assignment.

    -R

    Right justify and fill with leading blanks. If n is non-zero it defines the width of the field, otherwise it is determined by the width of the value of first assignment. The field is left filled with blanks or truncated from the end if the variable is reassigned. The -L flag is turned off.

    -t

    Tags the variables. Tags are user definable and have no special meaning to the shell.

    -u

    All lowercase characters are converted to uppercase characters. The lowercase flag, -l is turned off.

    -x

    The specified names are marked for automatic export to the environment of subsequently-executed commands.

    -Z

    Right justify and fill with leading zeros if the first non-blank character is a digit and the -L flag has not been set. If n is non-zero it defines the width of the field. Otherwise, it is determined by the width of the value of first assignment.

    The -i attribute can not be specified along with -R, -L, -Z, or -f.

    Using + rather than - causes these flags to be turned off. If no name arguments are specified but flags are specified, a list of names (and optionally the values) of the variables which have these flags set is printed. (Using + rather than - keeps the values from being printed.) If no names and flags are specified, the names and attributes of all variables are printed.

    For each name, whence indicates how it would be interpreted if used as a command name.

    The -v flag produces a more verbose report.

    The -p flag does a path search for name even if name is an alias, a function, or a reserved word.

    On this manual page, ksh(1) commands that are preceded by one or two * (asterisks) are treated specially in the following ways:

    1.
    Variable assignment lists preceding the command remain in effect when the command completes.
    2.
    I/O redirections are processed after variable assignments.
    3.
    Errors cause a script that contains them to abort.
    4.
    Words, following a command preceded by ** that are in the format of a variable assignment, are expanded with the same rules as a variable assignment. This means that tilde substitution is performed after the = sign and word splitting and file name generation are not performed.
     

    ksh93

    If the -f option is not specified, typeset sets, unsets, or displays attributes of variables as specified with the options. If the first option is specified with a - then the attributes are set for each of the specified names. If the first option is specified with a +, then the specified attributes are unset. If =value is specified, value is assigned before the attributes are set.

    When typeset is called inside a function that is defined with the function reserved word, and name does not contain a ., a local variable statically scoped to that function is created.

    Not all option combinations are possible. For example, the numeric options -i, -E, and -F cannot be specified with the justification options -L, -R, and -Z.

    The following preset aliases are set by the shell:

    float

    typeset -E

    functions

    typeset -f

    integer

    typeset -i

    nameref

    typeset -n

    If no names are specified, variables that have the specified options are displayed. If the first option is specified with a leading - then the name and value of each variable is written to standard output. Otherwise, only the names are written. If no options or only the -p option are specified, the names and attributes of all variables that have attributes are written to standard output. When -f is specified, the names displayed are function names.

    If -f is specified, then each name refers to a function and the only valid options are -u and -t. In this case no =value can be specified.

    typeset is built-in to the shell as a declaration command so that field splitting and pathname expansion are not performed on the arguments. Tilde expansion occurs on value.

    The following options are supported by the typeset built-in command in ksh93:

    -a

    Indexed array. This is the default.

    -A

    Associative array. Each name is converted to an associative array. If a variable already exists, the current value becomes index 0.

    -b

    Each name can contain binary data. Its value is the mime base64 encoding of the data. This option can be used with -Z, to specify fixed sized fields.

    -E [n]

    Floating point number represented in scientific notation. n specifies the number of significant figures when the value is expanded. The default value is 10.

    -f

    Each of the options and names refers to a function.

    -F [n]

    Floating point. n is the number of places after the decimal point when the value is expanded. The default value is 10.

    -H

    Hostname mapping. Each name holds a native pathname. Assigning a UNIX format pathname causes it to be converted to a pathname suitable for the current host. This has no effect when the native system is UNIX.

    -i [base]

    An integer. base represents the arithmetic base from 2 to 64. The option value can be omitted. The default value is 10.

    -l

    Convert uppercase characters to lowercase characters. Unsets the -u option. When used with -i, -E, or -F indicates long variant.

    -L [n]

    Left justify. If n is specified, it represents the field width. If the -Z attribute is also specified, then leading zeros are stripped. The option value can be omitted.

    -n

    Name reference. The value is the name of a variable that name references. name cannot contain a ..

    -p

    Causes the output to be in a format that can be used as input to the shell to recreate the attributes for variables.

    -r

    Enables read-only. Once this option is enabled, it cannot be disabled. See readonly(1).

    -R [n]

    Right justify. If n is specified it represents the field width. If the -Z option is also specified, zeros are used as the fill character. Otherwise, SPACEs are used.

    -s

    Restricts integer size to short when used with -i.

    -t

    When used with -f, enables tracing for each of the specified functions. Otherwise, -t is a user defined attribute and has no meaning to the shell.

    -T tname

    tname is the name of a type name given to each name.

    -u

    Without -f or -i, converts lowercase characters to uppercase and unsets -l. When used with -f, specifies that name is a function that has not yet been loaded. When used with -i specifies that the value is displayed as an unsigned integer.

    -x

    Puts each name on the export list. See export(1). name cannot contain a ..

    -Z [n]

    Zero fill. If n is specified it represents the field width. The option value can be omitted.

    The following exit values are returned by typeset in ksh93:

    0

    Successful completion.

    >0

    An error occurred.

    If the -v is not specified, whence writes on standard output an absolute pathname, if any, corresponding to name based on the complete search order that the shell uses. If name is not found, no output is produced.

    If the -v is specified, the output from whence also contains information that indicates how the specified name would be interpreted by the shell in the current execution environment.

    The following options are supported by the whence built-in command in ksh93:

    -a

    Display all uses for each name rather than the first.

    -f

    Do not check for functions.

    -p

    Do not check to see if name is a reserved word, a built-in, an alias, or a function.

    -v

    For each name specified, the shell displays a line that indicates if that name is one of the following:
    o Reserved word
    o Alias
    o Built-in
    o Undefined function
    o Function
    o Tracked alias
    o Program
    o Not found

    The following exit values are returned by whence in ksh93:

    0

    Successful completion. Each name was found by the shell.

    1

    One or more names were not found by the shell.

    >1

    An error occurred.

    On this manual page, ksh93(1) commands that are preceded by one or two + (plus signs) are treated specially in the following ways:

    1.
    Variable assignment lists preceding the command remain in effect when the command completes.
    2.
    I/O redirections are processed after variable assignments.
    3.
    Errors cause a script that contains them to abort.
    4.
    They are not valid function names.
    5.
    Words, following a command preceded by ++ that are in the format of a variable assignment, are expanded with the same rules as a variable assignment. This means that tilde substitution is performed after the = sign and word splitting and file name generation are not performed.
     

    ATTRIBUTES

    See attributes(5) for descriptions of the following attributes:

    ATTRIBUTE TYPEATTRIBUTE VALUE

    AvailabilitySUNWcsu

     

    SEE ALSO

    ksh(1), ksh93(1), readonly(1)set(1), sh(1), attributes(5)


     

    Index

    NAME
    SYNOPSIS
    ksh93
    DESCRIPTION
    ksh
    ksh93
    ATTRIBUTES
    SEE ALSO


    Поиск по тексту MAN-ов: 




    Партнёры:
    PostgresPro
    Inferno Solutions
    Hosting by Hoster.ru
    Хостинг:

    Закладки на сайте
    Проследить за страницей
    Created 1996-2024 by Maxim Chirkov
    Добавить, Поддержать, Вебмастеру