Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [ ! -t 0 ] && xset b off
- -t
- file (descriptor) is associated with a terminal device
- This test option may be used to check whether the stdin [ -t 0 ]
- or stdout [ -t 1 ] in a given script is a terminal.
- function xruns {
- if [[ `pstree -As $$ | grep xinit | wc -l` == 1 ]]; then
- echo "You are in X."
- else
- echo "You are not in X."
- fi
- }
- #!/usr/bin/zsh
- CURRENT_VT=`tty`
- if [[ ${CURRENT_VT[6]} == "p" ]]; # or `${CURRENT_VT:5:1}` in bash
- then
- # X stuff
- else
- # non-X stuff
- fi
- if xhost >& /dev/null ; then echo "Display exists"
- else echo "Display invalid" ; fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement