Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

This question already has an answer here:

So I have this 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

#

It's for flipping screen in my Lenovo S10-3t. I copied it from the netbook's wiki page, and added the #!/bin/bash at the top. The filename is flipscreen.sh. How can I make it work?

share|improve this question

marked as duplicate by Eliah Kagan, Alaa Ali, Eric Carvalho, Warren Hill, Andrea Corbellini Aug 10 at 18:49

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

4 Answers 4

Right click on the file, then choose "Properties". From the dialog check the "Allow executing file as program" like in the picture below. Then close the dialog and double-click on the file to execute.

alt text

share|improve this answer

First you need to make your file executable,

in directory type,

sudo chmod+x flipscreen.sh

sudo bash flipscreen.sh
share|improve this answer
    
I most cases you don't need sudo. If you don't need it, you must not use it. –  Aleksandr Levchuk May 1 '11 at 3:22

OpenNingia's answer will work, but for those who will come googling later, you can also do through the commandline:

open terminal, and goto the folder where your script is located

chmod +x <yourScript>

then execute it as

./<yourScript>
share|improve this answer
    
add a sudo at the beginning if the script is not in your home directory. –  theTuxRacer Nov 11 '10 at 9:45

Double click on the file. A dialogue box will ask you that the said file is executable what do you want to do. Click "run" and you should be good to go.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.