#!/bin/bash # æ¢åããã»ã¹ã®æ¨æºåºåã¨æ¨æºã¨ã©ã¼ã奪ã https://qiita.com/kawaz/items/96af6fa59fdf999b94bd # ã¿ã¼ã²ããã®PID pid=$1 [[ -d /proc/$1/fd ]] || exit 1 # åºåå ã¯ttyããã¡ã¤ã«ãæå® out="$2" # åºåå ã®æå®ããªãå ´åã¯ç¾å¨ã®ttyãåºåå ã«ãã if [[ -z $out ]]; then # ããã»ã¹ã«ç´ä»ããttyãåå¾ãã https://qiita.com/kawaz/items/bd33fe1e29876939dddb function search_tty() { local pid=${1:-$$} tty="" while [[ 1 -lt $pid ]]; do [[ -d /proc/$pid/fd ]] || break tty=$(
{{#tags}}- {{label}}
{{/tags}}