Hello list!
First of all I would like to thank the author of wmii for this
wonderful window manager.
I am puzzled at the moment by the following problem. I would like to
list a part of the content of a directory (in /dev/disk/by-id, list
all the files whose name starts with 'usb') and make a test on this
list in order to perform some actions. For some reasons which I do not
understand, the result of the test is not correct when called by
wmiirc, although the same test and commands work pretty well when
executed in a dash shell, or when wmiirc calls an external bash (but
not a dash) script in order to perform them.
Probably I'm doing something wrong, but I would be very pleased if
somebody could explain this "mystery" to me.
In order to be clear, here is an example of a (silly) test and command
which can be used to reproduce the problem.
Install wmii-3.9.2, and copy /etc/wmii/wmiirc into your
home directory. Modify it as follows:
------------------------------------------------------------------
$ diff /etc/wmii/wmiirc $HOME/.wmii/wmiirc
8,12c8,12
< MODKEY=Mod4
< UP=k
< DOWN=j
< LEFT=h
< RIGHT=l
--- > MODKEY=Mod1 > UP=Up > DOWN=Down > LEFT=Left > RIGHT=Right 65a66,85 > # Test functions > AAA() { > for i in $(ls $HOME/.wmii/* 2> /dev/null); do > j=${i##*/} > if [ -z "$(wmiir ls /rbar | grep test-$j)" ]; then > echo -n "$WMII_FOCUSCOLORS $j" | wmiir create /rbar/test-$j > sleep 1 > wmiir remove /rbar/test-$j > fi > done > } > > BBB() { > sh -c $HOME/.wmii/bbb > } > > CCC() { > sh -c $HOME/.wmii/ccc > } > 152a173,180 > > # Test functions key binding > Key $MODKEY-shift-a > AAA > Key $MODKEY-shift-b > BBB > Key $MODKEY-shift-c > CCC ------------------------------------------------------------------ The use of the arrow keys and of Mod1 is just for convenience, it has probably nothing to do with the problem. The function AAA is supposed to list the content of $HOME/.wmii in the right bar with focus colors, one file at a time, but it could be designed to perform any other task. The only important thing is the test that it contains, which is not really used here but which is the kind of test which I need to use in the more complicated context where I encountered my problem. The content of $HOME/.wmii/bbb is just the same as the commands executed by the function AAA: ------------------------------------------------------------------ #!/bin/dash -f for i in $(ls $HOME/.wmii/* 2> /dev/null); do j=${i##*/} if [ -z "$(wmiir ls /rbar | grep test-$j)" ]; then echo -n "$WMII_FOCUSCOLORS $j" | wmiir create /rbar/test-$j sleep 1 wmiir remove /rbar/test-$j fi done ------------------------------------------------------------------ Also the content of $HOME/.wmii/ccc is exactly the same, EXCEPT THAT it is declared as a bash instead of a dash script: ------------------------------------------------------------------ $ diff bbb ccc 1c1 < #!/bin/dash -f --- > #!/bin/bash ------------------------------------------------------------------ Both bbb and bcc have authorisations 755. It seems to me that $MODKEY-shift-[abc] should all have the same effect, as well as the same commands executed in a dash or bash shell. PROBLEM: This is not the case! - If I open a dash shell in a terminal and paste in it the 'for… done' commands of AAA, the content of $HOME/.wmii is listed in the right bar as it should be and the shell does not complain of any error. Of course it is the same with a bash shell. Also commands such as 'dash $HOME/.wmii/bbb' give the same result. - If I press $MODKEY-shift-c, again the content of $HOME/.wmii is listed in the right bar as it should be. - If I press $MODKEY-shift-b or $MODKEY-shift-a, nothing happens, just like if the test 'if [ -z … ]' in AAA (or $HOME/.wmii/bbb) fails. I have spent some time to understand what where the problem actually occurs, but at this point I'm stuck. Any hint? Regards, LuX.Received on Mon Jul 19 2010 - 02:43:22 CEST
This archive was generated by hypermail 2.2.0 : Mon Jul 19 2010 - 03:00:04 CEST