dotfiles/fish/functions/_pure_detect_container_by_pid_method.fish
Julius Klotz e1f49b8878 initial commit
2025-02-21 11:32:33 +01:00

15 lines
441 B
Fish

function _pure_detect_container_by_pid_method \
--description "Linux method to detect container using /proc. see https://stackoverflow.com/a/37015387/802365" \
--argument-names proc_sched
set --query proc_sched[1]; or set proc_sched /proc/1/sched
if test -e $proc_sched
head -n 1 $proc_sched \
| string match \
--quiet \
--invert \
--regex 'init|systemd'
end
end