자유게시판

?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

출처: https://stackoverflow.com/questions/34813704/bash-timed-input-show-countdown

https://stackoverflow.com/questions/33614865/bash-countdown-to-execution-if-no-key-pressed

 

예전에는 ligthdm webkit2를 사용했는데

요즘은 꼭 그럴 필요 있는건가 하는 생각이 들어서 그냥 lightdm을 지웠습니다

콘솔에서 로그인하고 startx를 실행하면 openbox가 실행되게 xinit을 작성했는데

매번 startx를 하려니 생각보다 귀찮았습니다

 

다행히 콘솔 로그인시 자동으로 startx를 실행하는 간단한 코드가 있었습니다.

출처: https://wiki.archlinux.org/index.php/Xinit


if [ -z "${DISPLAY}" ] && [ "${XDG_VTNR}" -eq 1 ]; then

  exec startx

fi


 

그런데 만약 콘솔을 사용하고 싶다면 어떻게 해야할까 생각이 들었습니다.

물론 c+a+f2로 tty2에서 로그인하면 되겠지만

귀찮거나, tty2가 정상적으로 안되는 상황이 생기지는 않을까 하는 생각이 들었습니다.

그래서 exec startx대신 적당한 스크립트를 찾아서 제가 원하는대로 작동하게 만들었습니다.

 


#!/bin/bash

 

total=3

count=0

while [ ${count} -lt ${total} ] ; do

  limit=$(( $total - $count ))

  echo -e "\rPress any input key or wait ${limit} seconds for startx\c"

  read -t 1 -n 1

  if [ $? = 0 ] ; then

    break

  fi

  count=$((count+1))

done

 

exec startx


 

이제 3초의 딜레이가 생기고

3초간 제가 아무짓도 안하던가,

3초가 지나기 전에 아무 키나 누르면

startx가 실행됩니다.

만약 콘솔을 사용하고 싶다면 c+c를 누르면 되겠네요.

  • ?
    가벼운게최고 2020.11.10 21:10

    c+c를 눌러도 콘솔화면이라기 보다는 로그인 화면으로 돌아가는걸 확인했습니다..

    어디서 잘못된건걸까요. ㅠ


  1. VPN의 보안 강화를 위하여 2차 인증 적용은 선택이 아닌 필수로 적용해야 할 최적의 방안

    Date2023.10.09 ByBaroPAM Views1341 Votes0
    Read More
  2. VPN 겨냥한 비밀번호 분사 공격을 방어하기 위한 방안

    Date2024.04.28 ByBaroPAM Views101 Votes0
    Read More
  3. Void Linux

    Date2018.11.09 ByOhnine Views1709 Votes0
    Read More
  4. VM웨어 써보신분

    Date2022.05.26 By다찌마와 Views643 Votes0
    Read More
  5. vmware 질문

    Date2022.02.10 Bymaama Views668 Votes0
    Read More
  6. VMware 무료 버전은 없나요?

    Date2021.05.12 By잘몰라요. Views2039 Votes0
    Read More
  7. VMware 로 저사항 세팅후 Windows 11 테스트

    Date2023.01.19 ByKongS Views630 Votes0
    Read More
  8. VLC 및 몇개의 프로그램에서 세로쓰기 글꼴이 표시 되는 문제입니다.

    Date2022.12.31 By까시 Views506 Votes0
    Read More
  9. visual studio 에서 c언어를 연습하고싶습니다

    Date2020.11.27 By라리컨디 Views997 Votes0
    Read More
  10. VirtualBox에서 USB인식 잘 되시나요?

    Date2018.11.26 Byiloveapink Views3217 Votes0
    Read More
  11. vgacon disables amdgpu kernel modesetting 이오류를 어떻게 해결해야 할까요

    Date2021.08.16 By라루미 Views2377 Votes0
    Read More
  12. USB 없이 설치

    Date2021.11.16 By해연 Views917 Votes0
    Read More
  13. USB 메모리에 설치하여 사용하는 웨인OS,,, 크롬 OS 기반 PC용 OS 공개

    Date2020.06.13 By말없는벌새 Views1484 Votes0
    Read More
  14. USB 마운트에 대한 질문입니다.

    Date2022.10.02 By잘몰라요. Views639 Votes0
    Read More
  15. Unsplash 랜덤 배경화면 스크립트

    Date2020.09.01 Bystoria Views598 Votes0
    Read More
  16. uLauncher

    Date2020.08.20 ByNimf,WakeUp-! Views692 Votes0
    Read More
  17. Ubuntu nvidia 그래픽 카드 설치

    Date2023.06.02 Byluis Views661 Votes0
    Read More
  18. ubuntu 18.04 포트 오픈이 안됩니다.

    Date2023.03.09 ByBlue_Sky Views571 Votes0
    Read More
  19. Ubuntu 18.04 LTS 다운로드

    Date2018.04.27 Byiskra Views1038 Votes0
    Read More
  20. TV 및 TV 박스 용 KDE Plasma Bigscreen, Android TV에 대한 Linux 대안

    Date2020.04.16 By펭귄들의행진 Views730 Votes0
    Read More
Board Pagination Prev 1 ... 72 73 74 75 76 77 78 79 80 81 ... 95 Next
/ 95
CLOSE