ParaMonte Fortran 2.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
pm_sysShell::shellis_type Type Reference

This is the shellis_type class for generating objects with logical components to determine the runtime shell type of the operating system. More...

Public Attributes

logical(LK) ash = .false._LK
 The scalar logical value indicating whether the shell is Unix Almquist shell (dash). More...
 
logical(LK) bash = .false._LK
 The scalar logical value indicating whether the shell is Unix GNU Bourne-Again shell (Bash). More...
 
logical(LK) cmd = .false._LK
 The scalar logical value indicating whether the shell is Windows Command Prompt (CMD). More...
 
logical(LK) csh = .false._LK
 The scalar logical value indicating whether the shell is Unix C shell (csh). More...
 
logical(LK) dash = .false._LK
 The scalar logical value indicating whether the shell is Unix Debian Almquist shell (dash). More...
 
logical(LK) fish = .false._LK
 The scalar logical value indicating whether the shell is Unix Friendly Interactive SHell (fish). More...
 
logical(LK) ksh = .false._LK
 The scalar logical value indicating whether the shell is Unix Korn shell (ksh). More...
 
logical(LK) posix = .false._LK
 The scalar logical value indicating whether the shell is POSIX-compliant (that is, Unix-like, partially or fully POSIX-compliant, e.g., pwsh (PowerShell Core), sh, bash, csh, zsh, fish, ...). More...
 
logical(LK) powershell = .false._LK
 The scalar logical value indicating whether the shell is the Microsoft PowerShell (pwsh). More...
 
logical(LK) sh = .false._LK
 The scalar logical value indicating whether the shell is Unix Bourne shell (sh). More...
 
logical(LK) tcsh = .false._LK
 The scalar logical value indicating whether the shell is Unix tcsh shell (tcsh). More...
 
logical(LK) windows = .false._LK
 The scalar logical value indicating whether the shell is Windows-compliant (e.g., pwsh on Windows (Windows PowerShell), CMD). More...
 
logical(LK) zsh = .false._LK
 The scalar logical value indicating whether the shell is Unix Z shell (zsh). More...
 
logical(LK) yash = .false._LK
 The scalar logical value indicating whether the shell is Unix Yet Another Shell (yash). More...
 

Detailed Description

This is the shellis_type class for generating objects with logical components to determine the runtime shell type of the operating system.

When an object of this type is generated, a single object component corresponding to runtime shell name is set to .true..
If the runtime shell name is determined to be sh, additional attempt will be made to resolve the actual runtime shell name.
This is because sh is frequently a symlink with an actual target (for example dash on Ubuntu).

POSIX-compliant shells

Additionally, the posix component of the object is set to .true. if the runtime shell name corresponds to,

  1. ash
  2. bash
  3. csh
  4. dash
  5. ksh
  6. pwsh (Microsoft PowerShell core)
  7. sh
  8. tcsh
  9. zsh
  10. yash

Normally (, but not necessarily), the runtime operating system for the above shells is Unix (either macOS or variants of linux).
As of July 2022, the above shells are known to have the highest level of compliance with the POSIX standard.

Windows-compliant shells

Alternatively, the windows component of the object is set to .true. if the runtime shell corresponds to,

  1. CMD
  2. Windows PowerShell

As of July 2022, the above shells are exclusively available on Windows operating systems.

Other shells

As of July 2022, shells that adhere to neither Windows nor POSIX conventions are the following,

  1. fish
Parameters
[out]failed: The output scalar logical of default kind LK that is .true. if and only if an error occurs while inferring the system shell name.
(optional. If missing and a runtime error occurs, the program will halt by calling error stop.)
[in,out]errmsg: The input/output scalar character of default kind SK of arbitrary length type parameter.
If an error occurs, errmsg will be set to a descriptive message about the nature of the runtime error.
A length of LEN_IOMSG characters is likely sufficient to capture most error messages in full.
(optional. It can be present only if failed is also present. If missing, no error message will be output.)
Returns
shell : The output scalar object of type shellis_type containing the specifics of the runtime system shell.


Possible calling interfaces

use pm_kind, only: LK
character(255, SK) :: errmsg
type(shellis_type) :: shell
logical(LK) :: failed
shell = shellis_type()
shell = shellis_type(failed)
shell = shellis_type(failed, errmsg)
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
Definition: pm_kind.F90:268
integer, parameter LK
The default logical kind in the ParaMonte library: kind(.true.) in Fortran, kind(....
Definition: pm_kind.F90:541
This module contains procedures and generic interfaces for inferring the runtime system shell type an...
Definition: pm_sysShell.F90:38
This is the shellis_type class for generating objects with logical components to determine the runtim...
See also
shell_type
isShellPosix
isShellWindows
Comparison of command shells


Example usage

1program example
2
3 use pm_kind, only: LK, IK, SK
4 use pm_io, only: display_type
6
7 implicit none
8
9 type(shellis_type) :: shellis
10 logical(LK) :: failed
11 character(255, SK) :: errmsg
12
13 type(display_type) :: disp
14 disp = display_type(file = "main.out.F90")
15
16 call disp%skip()
17 call disp%show("shellis = shellis_type()")
18 shellis = shellis_type()
19 call dispShellIs()
20 call disp%skip()
21
22 call disp%skip()
23 call disp%show("shellis = shellis_type(failed)")
24 shellis = shellis_type(failed)
25 call disp%show("failed ! Check if any error has occurred.")
26 call disp%show( failed )
27 if (failed) then
28 call disp%show("SK_'error occurred.'")
29 call disp%show( SK_'error occurred.' , deliml = SK_"""" )
30 else
31 call dispShellIs()
32 end if
33 call disp%skip()
34
35 call disp%skip()
36 call disp%show("shellis = shellis_type(failed, errmsg)")
37 shellis = shellis_type(failed, errmsg)
38 call disp%show("failed ! Check if any error has occurred.")
39 call disp%show( failed )
40 if (failed) then
41 call disp%show("errmsg")
42 call disp%show( errmsg , deliml = SK_"""" )
43 else
44 call dispShellIs()
45 end if
46 call disp%skip()
47
48contains
49
50 subroutine dispShellIs()
51 call disp%show("shellis%ash ")
52 call disp%show( shellis%ash )
53 call disp%show("shellis%bash ")
54 call disp%show( shellis%bash )
55 call disp%show("shellis%csh ")
56 call disp%show( shellis%csh )
57 call disp%show("shellis%cmd ")
58 call disp%show( shellis%cmd )
59 call disp%show("shellis%dash ")
60 call disp%show( shellis%dash )
61 call disp%show("shellis%fish ")
62 call disp%show( shellis%fish )
63 call disp%show("shellis%ksh ")
64 call disp%show( shellis%ksh )
65 call disp%show("shellis%posix ")
66 call disp%show( shellis%posix )
67 call disp%show("shellis%powershell ")
68 call disp%show( shellis%powershell )
69 call disp%show("shellis%sh ")
70 call disp%show( shellis%sh )
71 call disp%show("shellis%tcsh ")
72 call disp%show( shellis%tcsh )
73 call disp%show("shellis%windows ")
74 call disp%show( shellis%windows )
75 call disp%show("shellis%zsh ")
76 call disp%show( shellis%zsh )
77 call disp%show("shellis%yash ")
78 call disp%show( shellis%yash )
79 end subroutine
80
81end program example
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11726
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11508
This module contains classes and procedures for input/output (IO) or generic display operations on st...
Definition: pm_io.F90:252
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
Definition: pm_io.F90:11393
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
Definition: pm_kind.F90:540
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
Definition: pm_kind.F90:539
Generate and return an object of type display_type.
Definition: pm_io.F90:10282

Example Unix compile command via Intel ifort compiler
1#!/usr/bin/env sh
2rm main.exe
3ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example Windows Batch compile command via Intel ifort compiler
1del main.exe
2set PATH=..\..\..\lib;%PATH%
3ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
4main.exe

Example Unix / MinGW compile command via GNU gfortran compiler
1#!/usr/bin/env sh
2rm main.exe
3gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example output
1
2shellis = shellis_type()
3shellis%ash
4F
5shellis%bash
6F
7shellis%csh
8F
9shellis%cmd
10F
11shellis%dash
12T
13shellis%fish
14F
15shellis%ksh
16F
17shellis%posix
18T
19shellis%powershell
20F
21shellis%sh
22F
23shellis%tcsh
24F
25shellis%windows
26F
27shellis%zsh
28F
29shellis%yash
30F
31
32
33shellis = shellis_type(failed)
34failed ! Check if any error has occurred.
35F
36shellis%ash
37F
38shellis%bash
39F
40shellis%csh
41F
42shellis%cmd
43F
44shellis%dash
45T
46shellis%fish
47F
48shellis%ksh
49F
50shellis%posix
51T
52shellis%powershell
53F
54shellis%sh
55F
56shellis%tcsh
57F
58shellis%windows
59F
60shellis%zsh
61F
62shellis%yash
63F
64
65
66shellis = shellis_type(failed, errmsg)
67failed ! Check if any error has occurred.
68F
69shellis%ash
70F
71shellis%bash
72F
73shellis%csh
74F
75shellis%cmd
76F
77shellis%dash
78T
79shellis%fish
80F
81shellis%ksh
82F
83shellis%posix
84T
85shellis%powershell
86F
87shellis%sh
88F
89shellis%tcsh
90F
91shellis%windows
92F
93shellis%zsh
94F
95shellis%yash
96F
97
98


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Amir Shahmoradi, Tuesday March 7, 2017, 3:50 AM, Institute for Computational Engineering and Sciences (ICES), The University of Texas at Austin

Definition at line 196 of file pm_sysShell.F90.

Member Data Documentation

◆ ash

logical(LK) pm_sysShell::shellis_type::ash = .false._LK

The scalar logical value indicating whether the shell is Unix Almquist shell (dash).

Definition at line 197 of file pm_sysShell.F90.

◆ bash

logical(LK) pm_sysShell::shellis_type::bash = .false._LK

The scalar logical value indicating whether the shell is Unix GNU Bourne-Again shell (Bash).

Definition at line 198 of file pm_sysShell.F90.

◆ cmd

logical(LK) pm_sysShell::shellis_type::cmd = .false._LK

The scalar logical value indicating whether the shell is Windows Command Prompt (CMD).

Definition at line 199 of file pm_sysShell.F90.

◆ csh

logical(LK) pm_sysShell::shellis_type::csh = .false._LK

The scalar logical value indicating whether the shell is Unix C shell (csh).

Definition at line 200 of file pm_sysShell.F90.

◆ dash

logical(LK) pm_sysShell::shellis_type::dash = .false._LK

The scalar logical value indicating whether the shell is Unix Debian Almquist shell (dash).

Definition at line 201 of file pm_sysShell.F90.

◆ fish

logical(LK) pm_sysShell::shellis_type::fish = .false._LK

The scalar logical value indicating whether the shell is Unix Friendly Interactive SHell (fish).

Definition at line 202 of file pm_sysShell.F90.

◆ ksh

logical(LK) pm_sysShell::shellis_type::ksh = .false._LK

The scalar logical value indicating whether the shell is Unix Korn shell (ksh).

Definition at line 203 of file pm_sysShell.F90.

◆ posix

logical(LK) pm_sysShell::shellis_type::posix = .false._LK

The scalar logical value indicating whether the shell is POSIX-compliant (that is, Unix-like, partially or fully POSIX-compliant, e.g., pwsh (PowerShell Core), sh, bash, csh, zsh, fish, ...).

Definition at line 204 of file pm_sysShell.F90.

◆ powershell

logical(LK) pm_sysShell::shellis_type::powershell = .false._LK

The scalar logical value indicating whether the shell is the Microsoft PowerShell (pwsh).

Definition at line 205 of file pm_sysShell.F90.

◆ sh

logical(LK) pm_sysShell::shellis_type::sh = .false._LK

The scalar logical value indicating whether the shell is Unix Bourne shell (sh).

Note
The Shell Command Language (sh) is a programming language described by the POSIX standard.
Because sh is a specification, not an implementation, /bin/sh is a symlink (or a hard link) to an actual implementation on most POSIX systems.
The value sh = .true. implies that the runtime shell most likely points to a POSIX-compliant shell. To find out the target of sh, use the command file -h /bin/sh.

Definition at line 206 of file pm_sysShell.F90.

◆ tcsh

logical(LK) pm_sysShell::shellis_type::tcsh = .false._LK

The scalar logical value indicating whether the shell is Unix tcsh shell (tcsh).

Definition at line 211 of file pm_sysShell.F90.

◆ windows

logical(LK) pm_sysShell::shellis_type::windows = .false._LK

The scalar logical value indicating whether the shell is Windows-compliant (e.g., pwsh on Windows (Windows PowerShell), CMD).

Definition at line 212 of file pm_sysShell.F90.

◆ yash

logical(LK) pm_sysShell::shellis_type::yash = .false._LK

The scalar logical value indicating whether the shell is Unix Yet Another Shell (yash).

Definition at line 214 of file pm_sysShell.F90.

◆ zsh

logical(LK) pm_sysShell::shellis_type::zsh = .false._LK

The scalar logical value indicating whether the shell is Unix Z shell (zsh).

Definition at line 213 of file pm_sysShell.F90.


The documentation for this type was generated from the following file: