Guest User

Untitled

a guest
Jan 21st, 2022
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. start_environment() {
  2. ## Prompt the user asking whether or not a graphical session should be started. If the user inputs either 'y',
  3. ## 'Y', 'yes', YES, or 'Yes', then run start(1) if it is installed. Otherwise, attempt to run MULTIPLEXOR if it is
  4. ## installed. If neither of the above is possible, then do nothing.
  5. start_gui=0
  6. set -- y Y yes YES Yes
  7.  
  8. printf "Start graphical user interface? (y/n/N): "
  9. read -r user_answer
  10.  
  11. for answer in "${@}"
  12. do
  13. if [ "${user_answer}" = "${answer}" ]; then
  14. start_gui=1
  15. fi
  16. done
  17.  
  18. if [ "${start_gui}" -eq 1 ]; then
  19. if command -v startx > /dev/null 2>&1; then
  20. startx
  21. fi
  22. else
  23. if command -v "${MULTIPLEXOR}" > /dev/null 2>&1; then
  24. "${MULTIPLEXOR}"
  25. fi
  26. fi
  27. }
Advertisement
Add Comment
Please, Sign In to add comment