Набросал скрипт - вдруг кому пригодится:
a=`\ls /proc/|grep -m 1 tt`;echo ${a:1} `\ls /bin/|grep of -m 1|cut -c 1-4`r

ty pidor