• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

BASH scripting help

sciencewhiz

Diamond Member
I have a Thinkpad running RH 7.3. Normally, I use a USB mouse, and that is how my X configuration config file is set. However, when I am on battery power, I generally unplug the mouse, and use the built in trackpoint. This requires a slightly different configuration file. Right now, I just copy one or the other two to the correct location before I run X. I am hoping to automate the process slightly by having a prompt about which one I want to use.

Basically, I want to learn more about BASH scripting by doing this. What are some good (free) resources for learning about this?

Any other advice about other ways to do this would be great too 🙂
 
Just a wild guess, but maybe you can define two mice (InputDevices) in your XF86Config file?

If that's possible, and if you can put up with two active mice, that would obviate the need for a shell scripting solution. 🙂
 
#!/bin/sh
echo "[1] Mouse 1"
echo "[2] Mouse 2"
echo ""
echo -n "Which mouse? "
read mousenum

if [ $mousenum = 1 ]; then
echo "Switching to Mouse 1"
rm -f /etc/X11/XF86Config
ln -s /etc/X11/XF86Config-mouse1 /etc/X11/XF86Config
elif [ $mousenum = 2 ]; then
echo "Switching to Mouse 2"
rm -f /etc/X11/XF86Config
ln -s /etc/X11/XF86Config-mouse2 /etc/X11/XF86Config
else
echo "Did you even read the choices?"
exit
fi
# end

But since you want to learn, whatever i know came from the bash scripting guides at linuxdoc.org

 
Originally posted by: sciencewhiz
Originally posted by: n0cmonkey
man bash

😛

I would have posted more if I could. I dont use BASH and Im not sure of all its little quirks (it had some last time I tried to do some scripting in it). Plus, there is no other real way to learn the scripting than to read a book or man page and do it. There is just too much there to spell out in a post on a BB and have enough information in there to be worthwhile.
 
Whiz do you have the thinkpad with a 3 button trackpoint where you can hold the lower one and use it as a scroll? Do you have it working? I've just set mine up to scroll and it finally works. I'm thrilled and want to spread the word hehe.
 
Soybomb, how did you get scroll on the 3rd button? It is a wierd implementation that hasn't been done yet.

Examples?
 
Noc, I've read enough of your posts, and I didn't expect anything more then man bash 😉 I was just using that as a cheap bump.

soybomb, yes that is the kind that I have, and I have not attempted to do anything with the scrolling. I do use my optical mouse more, but I would be interested in how you got yours working.
 
Originally posted by: sciencewhiz
Noc, I've read enough of your posts, and I didn't expect anything more then man bash 😉 I was just using that as a cheap bump.

soybomb, yes that is the kind that I have, and I have not attempted to do anything with the scrolling. I do use my optical mouse more, but I would be interested in how you got yours working.

Waiting for someone to just hand you the answer? 😛
 
Back
Top