does_command_exist Function

private pure function does_command_exist(arg, cmd_list) result(res)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: arg
character(len=LEN_CMD), intent(in) :: cmd_list(:)

Return Value logical


Source Code

   pure function does_command_exist(arg, cmd_list) result(res)
      implicit none
      character(*), intent(in) :: arg
      character(LEN_CMD), intent(in) :: cmd_list(:)
      logical :: res
      integer :: i

      res = .false.
      do i = lbound(cmd_list, dim=1), ubound(cmd_list, dim=1)
         res = res .or. trim(arg) == trim(cmd_list(i))
         if (res) return
      end do
   end function does_command_exist