command_not_found Function

public function command_not_found(cmd)

True when the program invoked by cmd cannot be located on PATH (nor as a direct path). Cross-platform via which()/exists().

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: cmd

Return Value logical


Source Code

logical function command_not_found(cmd)
    character(*), intent(in) :: cmd
    character(:), allocatable :: prog

    command_not_found = .false.
    prog = command_program(cmd)
    if (len_trim(prog) == 0) return
    if (len_trim(which(prog)) == 0 .and. .not. exists(prog)) command_not_found = .true.

end function command_not_found