Broadcast to myself 

Usage 

for tty in `ps -ef | grep ${USER-$LOGNAME} | cut -c34-42 | grep -v '^?' | sort | uniq` ; do echo $tty> /dev/$tty; echo asdd > /dev/$tty; done
  • *N*:, strange, I could use $USER quite well before!?
  • the uniq is required, see trying history.

Trying History 

ps -ef | grep ${USER-$LOGNAME} | cut -c34-42 | grep -v '^?'

1st time 2 pts, then 1 for all the tries

for tty in `ps -ef | grep ${USER-$LOGNAME} | cut -c34-42 | grep -v '^?'` ; do echo $tty> /dev/$tty; echo asdd > /dev/$tty; done

2 pts!

ps -ef | grep ${USER-$LOGNAME} | cut -c34-42 | grep -v '^?'

1 pts, why for is 2?

em, then suspend, then

ps -ef | grep ${USER-$LOGNAME} | cut -c34-42 | grep -v '^?'

2 pts!

Problem 

what if no user current login?

iitrc:~/bin$ for t in ''; do echo aa-$t-aa; done
aa--aa
iitrc:~/bin$ for t in ; do echo aa-$t-aa; done
bash: syntax error near unexpected token `;'

we're in trouble. — put into varible and test grep return.

documented on: 04-11-99 11:17:12