Re: builtin printf not printing unicode characters?
On Sunday 11 May 2008 04:16, Chet Ramey wrote: > pk wrote: >> The man page says that bash builtin printf supports the standard >> printf(1) formats. But it seems that \u is not working: >> >> $ /usr/bin/printf '\u212b\n' >> Å >> $ printf '\u212b\n' >> \u212b >> >> Am I doing something wrong here? > > The `\u' format string escape is not standard. I will consider it for a > future enhancement. Ah ok, I was fooled by the fact that printf(1) on my system does include the \u format. Thanks
what matched in a case statement
Is there any way to get a handle on what matched in a case statement? Something like this: case "lawlesspoets" in *poets) echo $CASEMATCH one ;; lawless*) echo $CASEMATCH two ;; esac -- Yorick
Re: possible compgen bug
> Nicholas Mc Guire wrote: > > > probably errornous behavior: > > > > > > when using compgen to allow shortcuts (in the below example for quit and > > exit I get a strange behavior when no input is entered and write times > > out after 5 seconds: > > > > #! /bin/bash > > > > read -p "timeout 5 > " -t 5 FOO > > CMD=( $(compgen -W "quit exit" -- $FOO) ) > > > > if [ "$CMD"x == exitx ] ; then > >echo exiting > >$CMD > > elif [ "$CMD"x == quitx ] ; then > >echo quit not a valid command calling exit with -1 > >exit -1 > > else > >echo invalid command - exiting with -2 > >exit -2 > > fi > > > > [EMAIL PROTECTED]:~/shell$ ./2.sh > > timeout 5 > quit not a valid command calling exit with -1 > > [EMAIL PROTECTED]:~/shell$ > > > > it seems to expand CMD to quit - not the behavior I expected > > > > I assume that this is a bug in compgen as it indentifies an empty string > > with the first word in the options passed - I would have expected it to be > > a null-string (just as if one would type x, which has no match, thus the > > null-string is assigned to CMD) > > When it is not supplied any word to complete, compgen displays all > possible completions -- in this case, the words supplied to `-W'. This > is what happens when you perform filename completion after no characters > have been typed, for instance. You can see this by running the compgen > command: > > $ compgen -W "quit exit" -- $FOO > quit > exit > > > Since the assignment to CMD makes it an array, it as if you assigned > CMD=(quit exit). > > You use $CMD in the rest of the script, which is the same as ${CMD[0]}, > or `quit'. > ok - sorry for filing this as bug-report - I did reread the manpage of bash a few times and we discussed it here with the obviously wrong conclusion that this is a incorect/unexpected behavior. thanks for the clarification !! hofrat
Re: PATH value doesn't get updated
Carl Wenrich wrote: > I just log into the box that appears on the standard ubuntu > startup. I enter my username and password, then the desktop comes > up. You are using GDM (GNOME Display Manager) then. In which case it won't automatically start up shells as login shells. It is a quirk of how the X session is started. > I see now that the .bash_profile isn't being sourced (I thought it > was according to what I've been able to pick up on the web). If I > source it manually, the $PATH gets updated. It would be sourced if you were to log into your machine with ssh or the text console. > Why does ubuntu provide the .bash_profile when a user is created, > and then not source it when the system starts up? And since it > doesn't, what do I change to make it happen? That is a long story. If you are interested you can read some archeology that has been done on this problem at this following URL. Note that even though the bug has been closed that it isn't fixed. I am hoping to getting back to driving on it again one day. http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=250765 Red Hat's solution seems to be the best. But it would require you to patch your system files. I recommend creating a $HOME/.xsession file, making it executable, with the following contents. Make sure it is executable. #!/bin/bash --login exec x-session-manager # Debian specific generic alternative. #exec gnome-session #exec startkde #exec fvwm2 chmod a+x ~/.xsession This invokes bash as a login shell and then invokes the X session manager. x-session-manager is an "alternative" in Debian and will automatically track the best installed manager. But others may be selected explicitly. (I use fvwm. :-) This is off topic for the bash list. If you have further problems the Ubuntu user mailing list would probably be your best place for more help about how to configure your Ubuntu system. If you contact me offlist I would continue to help you if you have problems with setting up an ~/.xsession file. Bob