linux - Lubuntu: Using .sh script as a keybind, code works, executing script gives errors -
this first ever post on stackoverflow, hope don't break rules. i'm complete linux newbie (installed lubuntu 14.04 64bit last night) duly warned.
in short, i'm trying laptop touchpad toggle work (fn+f3 on inspiron5110). have bash script:
#!/bin/bash if [ $(synclient -l | grep touchpadoff | awk '{print $3}') == 1 ] ; synclient touchpadoff=0; else synclient touchpadoff=1; fi
i got http://crunchbang.org/forums/viewtopic.php?id=10996 . if paste script code in terminal , execute it, works (touchpad goes on/off). however, want bind key in lubuntu-rc.xml i've added following:
<!-- disable touchpad --> <keybind key="xf86touchpadtoggle"> <action name="execute"> <command>/usr/local/bin/touchpad.sh</command> </action> </keybind>
when press necessary key combo "failure execute child process "/usr/local/bin/touchpad.sh" (no such file or directory)"
. can see in directory, both in file manager , when use ls
in terminal file there:
/usr/local/bin$ ls -l total 4 -rwxrwxr-x 1 paspaldzhiev paspaldzhiev 145 юни 2 22:54 touchpad.sh
i used chmod +x touchpad.sh
make executable.
now, gets more confusing:
if use bash /usr/local/bin/touchpad.sh
get:
paspaldzhiev@areuexperienced:/usr/local/bin$ bash touchpad.sh touchpad.sh: line 6: syntax error near unexpected token `fi' touchpad.sh: line 6: `fi'
though i've said above know fact code works if paste in terminal.
further, if use ./touchpad.sh
:
paspaldzhiev@areuexperienced:/usr/local/bin$ ./touchpad.sh bash: ./touchpad.sh: /bin/bash^m: bad interpreter: no such file or directory
just note i'm not sure difference between bash touchpad.sh
, ./touchpad.sh
in terms of execution, it's more linux-savvy friends told me try these :d.
in case, have no idea how proceed henceforth, please shed light on i'm doing wrong?
thank much!
the ^m in last error msg big hint ; -). somehow have used windows editor, file transfer or something. try dos2unix touchpad.sh
. remove cr (^m) chars end of lines. should work then. luck. – shellter
Comments
Post a Comment