쉘 스크립트를 실행할 수 없습니다

쉘 스크립트를 실행할 수 없습니다

그래서 저는 이 스크립트를 가지고 있습니다:

#!/bin/bash
# Flips the screen (hopefully)

syntax_error=0
orientation=0

current_orientation="$(xrandr -q --verbose | grep 'connected' | egrep -o  '\) (normal|left|inverted|right) \(' | egrep -o '(normal|left|inverted|right)')"
case $current_orientation in
        normal)
                current_orientation=0
        ;;
        left)
                current_orientation=1
        ;;
        inverted)
                current_orientation=2
        ;;
        right)
                current_orientation=3
        ;;
esac

if [ $current_orientation -eq 0 ]; then
        orientation=2
fi

if [ $current_orientation -eq 2 ]; then
        orientation=0
fi
method=evdev

# LENOVO S10-3t CHANGE ==> Hard Coded my device number to 11!!!!!!!!

device=11

swap=0
invert_x=0
invert_y=0
real_topx=0
real_topy=0
real_bottomx=4020
real_bottomy=4020

case $orientation in
        0)
                swap=0
                invert_x=0
                invert_y=0
                topx=$real_topx
                topy=$real_topy
                bottomx=$real_bottomx
                bottomy=$real_bottomy
        ;;
        1)
                swap=1
                invert_x=1
                invert_y=0
                topx=$real_topx
                topy=$real_topy
                bottomx=$real_bottomy
                bottomy=$real_bottomx
        ;;
        2 )
                swap=0
                invert_x=1
                invert_y=1
                topx=$real_topx
                topy=$real_topy
                bottomx=$real_bottomx
                bottomy=$real_bottomy
        ;;
        3 )
                swap=1
                invert_x=0
                invert_y=1
                topx=$real_topx
                topy=$real_topy
                bottomx=$real_bottomy
                bottomy=$real_bottomx
        ;;
esac

if [ $method = "evdev" ]; then
        xinput set-prop "$device" "Evdev Axes Swap" $swap
        xinput set-prop "$device" "Evdev Axes Swap" $swap
        xinput set-prop "$device" "Evdev Axis Inversion" $invert_x $invert_y
        xinput set-prop "$device" "Evdev Axis Calibration" $topx $bottomx $topy $bottomy
        if [ $orientation = 2 ]; then           
                xrandr -o inverted
        fi
        if [ $orientation = 0 ]; then
                xrandr -o normal
        fi
fi

#

Lenovo S10-3t의 화면을 뒤집는 데 사용됩니다. 넷북의 위키 페이지에서 복사하고 맨 위에 #!/bin/bash를 추가했습니다. 파일명은 Flipscreen.sh입니다. 어떻게 작동하게 할 수 있나요?

답변1

파일을 마우스 오른쪽 버튼으로 클릭한 다음 "속성"을 선택합니다. 대화 상자에서 아래 그림과 같이 "파일을 프로그램으로 실행 허용"을 선택하십시오. 그런 다음 대화 상자를 닫고 실행할 파일을 두 번 클릭합니다.

대체 텍스트

답변2

먼저 파일을 실행 가능하게 만들어야 합니다.

디렉토리 유형에서,

sudo chmod+x flipscreen.sh

sudo bash flipscreen.sh

답변3

OpenNingia의 답변은 효과가 있지만 나중에 인터넷 검색을 할 사람들을 위해 명령줄을 통해서도 할 수 있습니다.

터미널을 열고 스크립트가 있는 폴더로 이동하세요.

chmod +x <yourScript>

그런 다음 다음과 같이 실행하십시오.

./<yourScript>

답변4

파일을 두 번 클릭하십시오. 해당 파일이 실행 가능하다는 것을 묻는 대화 상자가 나타납니다. 무엇을 하시겠습니까? "실행"을 클릭하면 됩니다.

관련 정보