It sometimes comes up that the usual trick of reading in a stream with a pipe and a while loop doesn't work, since the pipe causes a subshell and any variables set in the subshell are unavailable to the parent.
For example the normal trick (output the first few lines of the /etc/services file, just the first two columns and not empty or comment lines):
[uphill@zagreb]: grep -v ^# /etc/services | grep -v ^$ | head | awk '{print $1" "$2;}'
tcpmux 1/tcp
tcpmux 1/udp
rje 5/tcp
rje 5/udp
echo 7/tcp
echo 7/udp
discard 9/tcp
Sometimes it's easier to write a quick script in bash that uses arrays rather than figure out how to do it with something more appropriate like awk or perl.
It's really very quick and simple. To start, declare your variable as an array
[uphill@host]: declare -a myvar
If the array is going to be global then add x to export it.
[uphill@host]: declare -ax myvar
Then you can put things into your array like this:
In RHEL4 and possibly other distros. The .Xdefaults file is not used, the file is now called .Xresources
In /etc/X11/xinit/xinitrc-common, xrdb is passed .Xresources _after_ /etc/X11/Xresources.
You can make systemwide changes in /etc/X11/Xresources, but they will be overridden by changes to .Xresources.
I'm hoping that someone else has a better solution for this one. We have a pocketpoint remote that works quite well for Power point presentations, but for Acrobat Reader the keybinding is not good. The remote sends p for prior/previous and n for next, which is understood by powerpoint and not by Adobe. I wrote the following lame script to fix this. It works for the most part, but you lose the p and n keys during the presentation.
[includecode#../scripts/pocketpoint]
First run xev to see what the keycode is for your Windows Key
On my keyboard it is 115 and is bound to Super_L.
This laptop is 100% Lenovo. It's a lot different!
I did get the ATI driver working. Update, the ChipID hack is no longer needed, Release 8.25.18 adds support for the V5200.
Sleeping
Finally, 2.6.17-rc6 is able to make this thing sleep and wake properly, phew. Ok, I seem to have a working RPM, so I'll post it, let me know if you have issues with this rpm, I've resumed a few times without issue. This is the Fedora RPM with all the patches but 2.6.17-rc6 removed.≐ | approaches limit | \doteq | ⊧ | models | \models |
∐ | amalgamation | \amalg |
I sometimes have to transfer files with spaces in the names, I like using a for loop, but the usual way doesn't work.
Usual way:
for file in `find . -type f|grep .ext$` do /do/something/to $file done
To get around this I use a while loop with a read instead. Using the read will read to the end of the line, enclosing within quotes escapes the spaces.
Unusual way:
A | α | Alpha | A | \alpha | N | ν | Nu | N | \nu | |