#!/usr/bin/env python3 import sys import re with open("/proc/self/net/dev", "r") as f: data = f.read() match = re.search("^enp[0-9a-z]+:", data, re.MULTILINE) if match is None: sys.exit(1) else: sys.exit(0)