This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Can't get script to run

Tags: None
(comma "," separated)
tlinux
Registered Member
Posts
15
Karma
0
OS

Can't get script to run

Fri May 21, 2010 4:45 pm
#!/bin/bash
# toggle synaptic touchpad on/off

# get current state
SYNSTATE=$(synclient -l | grep TouchpadOff | awk '{ print $3 }')

# change to other state
if [ $SYNSTATE = 0 ]; then
    synclient touchpadoff=1
elif [ $SYNSTATE = 1 ]; then
    synclient touchpadoff=0
else
    echo "Couldn't get touchpad status from synclient"
    exit 1
fi
exit 0


I'm trying to get the above script to run on startup. It's supposed to turn off the TouchPad on my notebook computer. I can't get it to run. The above file is stored in my Home directory as togglepad.sh.

I can turn off the TouchPad by entering synclient TouchpadOff=1 in the Konsole terminal. However, I have to do this every time I start up so I'd like the script to do it for me. The script is enabled and set to run on startup, but it doesn't run.

Does anyone have any suggestions for how to get this to run on startup?

Thank you.
User avatar
Hans
Administrator
Posts
3304
Karma
24
OS

Re: Can't get script to run

Fri May 21, 2010 5:39 pm
Does it work if you run the script manually, e.g. ~/togglepad.sh ?


Problem solved? Please click on "Accept this answer" below the post with the best answer to mark your topic as solved.

10 things you might want to do in KDE | Open menu with Super key | Mouse shortcuts
tlinux
Registered Member
Posts
15
Karma
0
OS

Re: Can't get script to run

Fri May 21, 2010 8:39 pm
when I run "./togglepad.sh" I get

tom@DellNotebook:~$ ./togglepad.sh
./togglepad.sh: line 1: #!/bin/bash: No such file or directory
./togglepad.sh: line 11:  : command not found
tom@DellNotebook:~$


What is this telling me?

Thanks.
User avatar
dpalacio
Registered Member
Posts
240
Karma
2
OS

Re: Can't get script to run

Sat May 22, 2010 12:07 am
It is telling you that the Bash shell is not installed. Change

#!/bin/bash

to

#!/bin/sh

and try again. If it does not work, you have to install bash or a bash-compatible shell.


connect(post, SIGNAL(readSignature()), qapp, SLOT(quit()));
tlinux
Registered Member
Posts
15
Karma
0
OS

Re: Can't get script to run

Sat May 22, 2010 2:55 am
I changed "togglepad.sh" as follows:

#!/bin/sh
# toggle synaptic touchpad on/off

# get current state
SYNSTATE=$(synclient -l | grep TouchpadOff | awk '{ print $3 }')

# change to other state
if [ $SYNSTATE = 0 ]; then
    synclient touchpadoff=1
elif [ $SYNSTATE = 1 ]; then
    synclient touchpadoff=0
else
    echo "Couldn't get touchpad status from synclient"
    exit 1
fi
exit 0


It didn't work. The Konsole output was:

tom@DellNotebook:~$ ./togglepad.sh
./togglepad.sh: 15:  : not found
tom@DellNotebook:~$



It doesn't seem to like line 15 which contains "fi". I commented out "fi" and the terminal output said it couldn't find "fi".

"bash" is installed.

What to do? Thanks!
User avatar
dpalacio
Registered Member
Posts
240
Karma
2
OS

Re: Can't get script to run

Sat May 22, 2010 4:33 am
What does "which bash" say?


connect(post, SIGNAL(readSignature()), qapp, SLOT(quit()));
tlinux
Registered Member
Posts
15
Karma
0
OS

Re: Can't get script to run

Sat May 22, 2010 5:15 am
tom@DellNotebook:~$ which bash
/bin/bash
tom@DellNotebook:~$


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot]