Switch to POSIX shell
Component: | POSIX-BC |
Functional area: | POSIX administration and application |
Domain: | PROCEDURE |
Privileges: | STD-PROCESSING |
Function
The START-POSIX-SHELL command opens a POSIX shell, so that the user can work in a UNIX-based environment within BS2000.
The POSIX shell is the command interface to a UNIX kernel (UNIX System V) ported to BS2000.
Within the POSIX shell, users can take advantage of the extensive UNIX command language (compliant with the POSIX standard). The shell provides access to the POSIX file system implemented in BS2000, which is organized like a UNIX file system.
The POSIX shell will not be opened unless the POSIX subsystem is loaded and is in the *AVAILABLE status (see the SHOW-POSIX-STATUS command).
Once the POSIX shell has been successfully accessed, the shell prompt is displayed. The default prompt for nonprivileged POSIX users is $ (the value of the shell’s PS1 environment variable). The shell is now ready for input from the interactive terminal. See the “POSIX Commands” manual [29] for a description of the input which is allowed (the supported POSIX command set) and for general information on working with the POSIX shell.
The POSIX shell is closed by the POSIX command exit. The user then goes back to working in BS2000 in the usual way.
Requirement for accessing the POSIX shell
The POSIX shell cannot be accessed unless there is a suitable user entry authorizing POSIX use. This entry contains the following POSIX-specific user attributes:
user login name
user ID number
group ID number
explanatory comment
name of the POSIX directory in which the user’s POSIX files will be stored (home directory)
name of the POSIX program that will be started up when the user accesses the shell (by default the interactive POSIX shell)
A privileged user (POSIX-ADMINISTRATION privilege) assigns these user attributes with the MODIFY-POSIX-USER-ATTRIBUTES command, and with the MODIFY-POSIX-USER-DEFAULTS can also define default values which are automatically allocated to the POSIX user entry whenever a new BS2000 user entry is created (see the ADD-USER command). The SHOW-POSIX-USER-ATTRIBUTES command provides information on a POSIX user entry. The SHOW-POSIX-USER-DEFAULTS command lists the current default values.
Format
START-POSIX-SHELL | Alias: POSIX-SH |
VERSION = *STD / <product-version without-man-corr> |
Operands
VERSION = *STD / <product-version without-man-corr>
Specifies the version number of the program to call (in this case the POSIX shell). The default is *STD, which means that the currently available version will be called.
Return codes
(SC2) | SC1 | Maincode | Meaning |
---|---|---|---|
0 | CMD0001 | No errors |
Notes
Input to the POSIX shell is handled a block at a time and is thus not passed to the shell until the [EM] [DUE] keys or just [DUE] are pressed.
Entering the string @@d has the same effect as pressing the [END] key.
Entering the string @@c has the same effect as pressing the [DEL] key.
Example
/show-posix-user-attr ———————————————————————————————————————————————— (1)
%POSIX-USER-ATTRIBUTES --- PUBSET 2OSH 2017-02-04 13:49:57 %---------------------------------------------------------------------------- %USER-ID USER2 PUBSET 2OSH %USER-NUMBER 100 (DEFAULT) %GROUP-NUMBER 100 (DEFAULT) %COMMENT RLOGIN-BERECHTIGUNG %DIRECTORY /home/gast %PROGRAM *SHELL %---------------------------------------------------------------------------- %POSIX-USER-ATTRIBUTES END OF DISPLAY
/a='*** Text in BS2000 ***' —————————————————————————————————————————— (2)
/shv a,inf=*par(name=*none),out=bs2text —————————————————————————————— (3)
/copy-posix-file copy-dir=*to-posix,bs2000-file=bs2text,
posix-file=*by-source ————————————————————————————— (4)
/start-posix-sh —————————————————————————————————————————————————————— (5)
POSIX Basisshell 11.0A45 created Mar 23 2017 POSIX Shell 10.0A45 created Mar 07 2017 Copyright (C) Fujitsu Technology Solutions 2009 All Rights reserved Last login: Mon Jul 03 11:23:36 2017 on sf/002 ************************************************************************ ** POSIX - D236ZE14 ** ************************************************************************ ** In case of problems contact the administrator: ** ** ** ** Mr. Meier Tel. 10815 ** ************************************************************************
$ pwd ———————————————————————————————————————————————————————————————— (6)
/home/gast
$ ls -l —————————————————————————————————————————————————————————————— (7)
total 40 -rw-rw-rw- 1 100 USROTHER 12288 Sep 4 14:57 LCMD113 -rw-r--r-- 1 100 USROTHER 31 Feb 4 13:45 bs2text -rw-r--r-- 1 100 USROTHER 214 Jan 13 16:20 sicher
$ cat bs2text ———————————————————————————————————————————————————————— (8)
*** Text in BS2000 ***
$ echo $HOME ————————————————————————————————————————————————————————— (9)
/home/gast
$ exit —————————————————————————————————————————————————————————————— (10)
/write-text 'continue with BS2000'
continue with BS2000 ——————————————————————————————————————————————— (11)
(1) | The SHOW-POSIX-USER-ATTRIBUTES command lists the POSIX user attributes of user USER2. |
(2) | S variable A is assigned a text string. |
(3) | The SHV (SHOW-VARIABLE) command outputs the content of S variable A to the BS2TEXT file. |
(4) | The COPY-POSIX-FILE command copies the BS2000 file BS2TEXT to the POSIX file system. |
(5) | The START-POSIX-SHELL command opens the POSIX shell. |
(6) | The POSIX pwd command displays the path name of the current POSIX directory. |
(7) | The POSIX ls command lists the files in the current directory. |
(8) | The POSIX command cat displays the content of the BS2TEXT file which was copied beforehand from BS2000 (see item1). |
(9) | The POSIX echo command displays the value of the HOME shell variable (compare with the POSIX user attribute DIRECTORY under Point 1). |
(10) | The exit command closed the POSIX shell. |
(11) | Then BS2000 commands can be entered again, in this case the WRITE-TEXT command. |