fi
) | awk '!x[$0]++ && $1 !~ /^(lo)$/ {print}' | while read int; do
- infos=$(( ip addr show "$int" || ifconfig "$int") 2> /dev/null)
+ infos=$( (ip addr show "$int" || ifconfig "$int") 2> /dev/null )
mac=$(echo "$infos" | awk '/ether ([^ ]+)/{print $2}')
[ -z "$mac" ] && continue
;
}
-sys_cpu_temperature() {
+sys_temperatures() {
# Mac, others
# /sys/devices/platform/applesmc.768/temp*input
(
# NB 13.05.19 awk '{printf("%.1f\n",$1/1000)}' /sys/class/thermal/thermal_zone*/temp
#awk '{ count++; sum+=$1 } END {printf("%.1f",sum/count/1000)}' /sys/class/thermal/thermal_zone*/temp
}
+
+sys_mount_dir() {
+ local usage="Usage: sys_mount_dir DIR"
+
+ local dir=${1:?$usage}
+ [ ! -d "$dir" ] && echo "$usage" && return 1
+ local real_dir="$(cd "$dir" && pwd -P)"
+ [ 0 = 1 \
+ -o "$real_dir" = "/" \
+ -o "$real_dir" = "$(pwd)" \
+ ] && echo "Directory not allowed: $dir ( $real_dir )" && return 1
+
+ for i in proc dev dev/pts sys; do
+ echo mount -o bind /$i $dir/$i
+ done
+}