Your Browser is not longer supported

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

{{viewport.spaceProperty.prod}}

Sample session

&pagelevel(3)&pagelevel

This section contains an example showing how to work with the POSIX shell. Log on to BS2000, wait for the contents of your user ID to be output, and then start the POSIX shell. Firstly, create a .profile file in the POSIX shell, in which, in order to simplify your work, you define new alias variables and also a new prompt which outputs the current path. Following execution of the .profile file, the definitions made here become effective.
You then transfer a file from the BS2000 file system to the POSIX file system and process it there.

(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 09.0A43 created Feb 20 2012
     POSIX Shell 08.0A43 created Aug 02 2011
     Copyright (C) Fujitsu Technology Solutions 2009
                   All Rights reserved
(4)  Last login: Sun Jul 22 19:42:55 2012 on term/001
(5)  $ edtu .profile

(1)

Log on to BS2000 in the usual way.

(2)

Wait for your user ID to be output by the BS2000 command /SHOW-FILE-ATTRIBUTES.

(3)

Call the POSIX shell by means of the BS2000 command /START-POSIX-SHELL.

(4)

You are accepted as a POSIX shell user.

(5)

Create the .profile file with the POSIX editor edtu.Since the file does not exist, edtu creates a new file (see "Sample session").


   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)



(6)  $ . .profile
(7)  /home/user1> la
     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 having created the .profile file with edtu and having terminated the editor by means of the return command, the .profile file shall be evaluated in the current shell. To do this, enter . .profile.

(7)

The POSIX shell responds with the newly defined prompt, which outputs the current /home/user1 path.The list of all the files in the directory is displayed with the command defined by the alias la.

(8)

Go to the c-source subdirectory where, for example, your C programs are stored.

(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 prog.c file in the BS2000 file system to the POSIX file system. The file is written to the current c-source directory.

(10)

Output the contents of the prog.c file by entering cat.

(11)

Compile the prog.c file with the C compiler. The result of the compilation run should be written to the prog file.

(12)

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

(13)

Terminate the POSIX shell by means of the exit command.

(14)

Enter further BS2000 commands if desired.

(15)

Log off from BS2000.