Snippets Collections
#!/usr/bin/env sh

which() {
    local path

    if [ $# -gt 0 ]; then
        for path in $(IFS=: && echo ${PATH}); do
            [ -x "${path}/${1}" ] && echo -n "${path}/${1}" && return 0
        done

        return 1
    else
        echo >&2 "Usage: which COMMAND"
        echo >&2 "Writes the full path of COMMAND to standard output"

        return 255
    fi
}
star

Sat Jan 08 2022 07:33:03 GMT+0000 (Coordinated Universal Time) https://gist.github.com/juliyvchirkov/d2c7ff01846157f58b1fc1f3a3b1e36c

#shell #sh #which

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension