Не удается запустить сценарий оболочки [дубликат]

На этот вопрос уже есть ответ здесь:

Итак, у меня есть этот сценарий:

#!/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
задан 11 November 2010 в 12:18

4 ответа

Щелкните правой кнопкой мыши по файлу, затем выберите «Свойства». В диалоговом окне установите флажок «Разрешить выполнение файла как программы», как показано на рисунке ниже. Затем закройте диалоговое окно и дважды щелкните файл для выполнения.

alt text

0
ответ дан 11 November 2010 в 12:18

Сначала нужно сделать исполняемый файл,

в типе каталога,

sudo chmod+x flipscreen.sh

sudo bash flipscreen.sh
0
ответ дан 11 November 2010 в 12:18

Дважды щелкните файл. Диалоговое окно спросит вас, что указанный файл является исполняемым, что вы хотите сделать. Нажмите «запустить», и вы должны быть в порядке.

0
ответ дан 11 November 2010 в 12:18

Ответ OpenNingia будет работать, но для тех, кто придет в гугл позже, вы также можете сделать это через командную строку:

открыть терминал и перейти в папку, где находится ваш скрипт

chmod +x <yourScript>

затем выполните его как

./<yourScript>
0
ответ дан 11 November 2010 в 12:18

Другие вопросы по тегам:

Похожие вопросы: