No se puede ejecutar un script de shell

No se puede ejecutar un script de shell

Entonces tengo este script:

#!/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

#

Es para voltear la pantalla de mi Lenovo S10-3t. Lo copié de la página wiki del netbook y agregué #!/bin/bash en la parte superior. El nombre del archivo es flipscreen.sh. ¿Cómo puedo hacer que funcione?

Respuesta1

Haga clic derecho en el archivo, luego elija "Propiedades". En el cuadro de diálogo, marque "Permitir ejecutar archivo como programa", como en la imagen a continuación. Luego cierre el cuadro de diálogo y haga doble clic en el archivo para ejecutar.

texto alternativo

Respuesta2

Primero necesitas hacer que tu archivo sea ejecutable,

en tipo de directorio,

sudo chmod+x flipscreen.sh

sudo bash flipscreen.sh

Respuesta3

La respuesta de OpenNingia funcionará, pero para aquellos que buscarán en Google más tarde, también pueden hacerlo a través de la línea de comandos:

abra la terminal y vaya a la carpeta donde se encuentra su script

chmod +x <yourScript>

luego ejecutarlo como

./<yourScript>

Respuesta4

Doble click en el archivo. Un cuadro de diálogo le preguntará que dicho archivo es ejecutable y qué desea hacer. Haga clic en "ejecutar" y debería estar listo para comenzar.

información relacionada