FrontPage 

Fuego wiki

Login or create account

function check has program in split format

NAME [edit section]

= NAME =
check_has_program

SYNOPSIS [edit section]

= SYNOPSIS =
 * check_has_program <program_name>
The function check_has_program scans for the given program name on the target device's PATH, and if found puts the absolute path of the item into a variable. The variable is an uppercase version of the program name, prefixed by PROGRAM. (So, for example, if you called 'check_has_program ls', then it would return the result in a variable called 'PROGRAM_LS'.
The function check_has_program scans for the given program name on the target device's PATH, and if found puts the absolute path
of the item into a variable.  The variable is an uppercase version
of the program name, prefixed by PROGRAM.  (So, for example, if you
called 'check_has_program ls', then it would return the result in
a variable called 'PROGRAM_LS'.
This routine checks for the existence of the program using the 'command -v' shell builtin command on the target board. Note that for most shells, this returns the full path of the program. For busybox ash, this returns just the program name.
This routine checks for the existence of the program using the 'command -v'
shell builtin command on the target board.  Note that for most shells,
this returns the full path of the program.  For busybox ash, this returns
just the program name.

NOTE: This function is for use when the test wants to check for a program without aborting if the program is not there. uses of this can now be replaced with assert_has_program. If applicable, please use that function instead of calling this one directly. This function is intended to replace is_on_target_path

''NOTE: This function is for use when the test wants to check for a
 program without aborting if the program is not there. uses of this can now be replaced with [[function_assert_has_program|assert_has_program]].  If applicable, please
use that function instead of calling this one directly.  This function is intended to replace is_on_target_path''

EXAMPLES [edit section]

= EXAMPLES =
Here are some sample invocations:
{{{#!YellowBox
    check_has_program java
    if [ "$PROGRAM_JAVA" = "<missing>" ] ; then
        echo "doing something without using java"
        ...
    fi
}}}

ENVIRONMENT and ARGUMENTS [edit section]

= ENVIRONMENT and ARGUMENTS =
 * $1 is the program to find in the remote filesystem

RETURN [edit section]

= RETURN =
If the item is found, the full path to
the item is returned as the value of the variable.  If not found,
then the variable has the string "<missing>".

SOURCE [edit section]

= SOURCE =
Located in ''scripts/functions.sh''

SEE ALSO [edit section]

is_on_target_path, assert_has_program, get_program_path
= SEE ALSO =
 * [[function_is_on_target_path|is_on_target_path]], [[function_assert_has_program|assert_has_program]],
[[function_get_program_path|get_program_path]]
TBWiki engine 1.8.3 by Tim Bird