Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Example

&pagelevel(3)&pagelevel

This section presents an example of operation using the POSIX shell. You log onto the BS2000, output the directory which corresponds to your user ID and start the POSIX shell. Once in the POSIX shell, you first create a .profile file in which you define alias variables to simplify operation and specify a new prompt which displays the current path at any given time as an aid to orientation. Once the .profile file has been executed, the definitions it contains take effect.
You then transfer a file from the BS2000 file system to the POSIX file system where you process it.

(1)  /set-logon-parameters user-id=user1,account=...                            
(2)  /show-file-attributes
     %     114 :1OSN:$USER1.ANHANG.V2
     %       3 :1OSN:$USER1.AVASQUER
     %      78 :1OSN:$USER1.BIB.EXAMPLES.SDF
     %       6 :1OSN:$USER1.DO.MSGCHECK
     %    5007 :1OSN:$USER1.FS.USER1
     %       3 :1OSN:$USER1.MSG.PROT
     %       3 :1OSN:$USER1.OUTPUT
     %       3 :1OSN:$USER1.PROG.C
     %       3 :1OSN:$USER1.SYS.SDF.LOGON.USERPROC
(3)  /start-posix-shell
     POSIX Basisshell 11.0A45 created Sep 20 2017
     POSIX Shell 10.0A45 created Mar 07 2017
     Copyright (C) Fujitsu Technology Solutions GmbH 2019
                   All Rights reserved
(4)  Last login: Fri Jun  5 07:44:21 2020 on term/001 
(5)  $ edtu .profile

(1)

Log on to the BS2000 as usual.

(2)

Use the BS2000 command SHOW-FILE-ATTRIBUTES to display the directory corresponding to your login name.

(3)

Use the BS2000 command START-POSIX-SHELL to call the POSIX shell.

(4)

You are accepted as a POSIX shell user.

(5)

Create the .profile file with the POSIX editor edt. Since the file does not exist, edt creates a new file (see below).

   1.00 alias ll='ls -l'                                                        
   2.00 alias la='ls -al'                                                       
   3.00 PS1='$PWD> '                                                            
   4.00                                                                         
   5.00                                                                         
   6.00                                                                         
   7.00                                                                         
   8.00                                                                         
   9.00                                                                         
  10.00                                                                         
  11.00                                                                         
  12.00                                                                         
  13.00                                                                         
  14.00                                                                         
  15.00                                                                         
  16.00                                                                         
  17.00                                                                         
  18.00                                                                         
  19.00                                                                         
  20.00                                                                         
  21.00                                                                         
  22.00                                                                         
                     POSIX edtu opened file: .profile (new)                     
return                                                         0000.00:00001(00)
     workfile 00: ufs file '.profile' saved                                     
(6)  $ . ./.profile
(7)  /home/user1>
     total 84
     drwxr-xr-x   5 USER1    USROTHER    2048 Dec 22 14:03 .
     drwxr-xr-x  63 SYSROOT  POSSYS      2048 Dec 22 06:35 ..
     -rw-r--r--   1 USER1    USROTHER      48 Dec 22 14:02 .profile
     -rw-------   1 USER1    USROTHER    2576 Dec 22 14:06 .sh_history
     drwxr-xr-x   2 USER1    USROTHER    2048 Dec 15 17:18 c-source
     drwxr-xr-x   2 USER1    USROTHER    8192 Dec  5 13:47 lost+found
     -rw-r--r--   1 USER1    USROTHER      94 Dec 21 14:02 letter1
     drwxr-xr-x   2 USER1    USROTHER    2048 Dec 19 15:05 test
       ...
(8)  /home/user1> cd c-source

(6)

After creating the .profile file with edt and quitting the editor with the command return, you should evaluate the .profile file in the current shell. To do this, enter . ./.profile.

(7)

The POSIX shell reports with the newly defined prompt which displays the current path /home/user1. You use the command for which the alias la has been defined to display all the files in the directory.

(8)

Change to the subdirectory c-source in which, for example, you store your C programs.

(9)  /home/user1/c-source> bs2cp bs2:prog.c prog.c                              
     /home/user1/c-source> la
     total 60
     drwxr-xr-x  2  USER1      USER1GRP     2048   Jul 6 .
     drwxr-xr-x  2  USER1      USER1GRP     2048   Jul 6 ..
     -rw-r--r--  1  USER1      USER1GRP     2048   Jul 6 prog.c 
(10) /home/user1/c-source> cat prog.c
     #include <stdio.h>
     main()
     {
       printf("hello world\n");
       return(0); 
     }
(11) /home/user1/c-source> cc -o prog prog.c
(12) /home/user1/c-source> prog
     hello world
(13) /home/user1/c-source> exit
(14)  ...
(15) /exit-job

(9)

Copy the file prog.c, which is located in the BS2000 file system, to the POSIX file system. The file is written to the current directory, c-source.

(10)

Use cat to output the contents of the file prog.c.

(11)

Compile the file prog.c using the C compiler. You want the result of the compilation to be written to the file prog.

(12)

Run the program prog. It outputs the string “hello world” on screen.

(13)

Enter the command exit to terminate the POSIX shell.

(14)

You may enter further BS2000 commands if you so wish.

(15)

Log off from BS2000.