Advertisement
Guest User

Untitled

a guest
Jan 20th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. [ ! -t 0 ] && xset b off
  2.  
  3. -t
  4.  
  5. file (descriptor) is associated with a terminal device
  6.  
  7. This test option may be used to check whether the stdin [ -t 0 ]
  8. or stdout [ -t 1 ] in a given script is a terminal.
  9.  
  10. function xruns {
  11. if [[ `pstree -As $$ | grep xinit | wc -l` == 1 ]]; then
  12. echo "You are in X."
  13. else
  14. echo "You are not in X."
  15. fi
  16. }
  17.  
  18. #!/usr/bin/zsh
  19.  
  20. CURRENT_VT=`tty`
  21.  
  22. if [[ ${CURRENT_VT[6]} == "p" ]]; # or `${CURRENT_VT:5:1}` in bash
  23. then
  24. # X stuff
  25. else
  26. # non-X stuff
  27. fi
  28.  
  29. if xhost >& /dev/null ; then echo "Display exists"
  30. else echo "Display invalid" ; fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement