lib/trace.sh

342 B · 19 lines · bash

1#!/usr/bin/env bash
2
3brt_trace() {
4 local host="${1:-}"
5 if [[ -z "$host" ]]; then
6 brt_error "Usage: brt -traceroute <host>"
7 exit 1
8 fi
9
10 if command -v traceroute &>/dev/null; then
11 traceroute "$host"
12 elif command -v tracert &>/dev/null; then
13 tracert "$host"
14 else
15 brt_error "traceroute not found"
16 exit 1
17 fi
18}
19