Re: New line in bash variables pain
On 14/11/06, Maxim Vexler [EMAIL PROTECTED] wrote: Hi list, any bash gurus in the house ?I'm having the most annoying issue with bash, one related to spacedelimited variables.I'd like to get a list in the form of :user1 password1user2 password2 Instead I'm getting:user1password1user2password2Here's an example:san-svn:/var/lib/svn# cat passwd.fake[users]user1 = password1 user2 = password2san-svn:/var/lib/svn#I'd like to automate this the import from this file into something likesan-svn:# htpasswd -b passwd.real user1 password1Two ways I could think of almost stright away: 1.# awk '/^[^[].+[^\n]$/ {print htpasswd -b passwd.real, $1, $3 }' passwd.fake | sh2.# awk '/^[^[].+[^\n]$/ {print $1, $3 }' passwd.fake | xargs -n 2 htpasswd -b passwd.real Maybe it's cheating but it should do the job... :)Thanks for the quiz,--Amos
Re: New line in bash variables pain
On Tue, 14 Nov 2006 11:56:18 Maxim Vexler wrote: I'm having the most annoying issue with bash, one related to space delimited variables. [snip] Here's an example: san-svn:/var/lib/svn# cat passwd.fake [users] user1 = password1 user2 = password2 [snip] I'd like to automate this the import from this file into something like san-svn:# htpasswd -b passwd.real user1 password1 Your using the awk/bash/xarg combination in a wrong way. You can do in bash ALONE very simply like this: PWF=your-fake-pass-file cat $PWF | ( while read USR EQ PAS REST do if [ $EQ = = ] ; then ## echo $USR $PAS# just to get pairs htpasswd -b passwd.real $USR $PAS # what you really want fi done ) Or, you can do by awk ALONE like this: PWF=your-fake-pass-file awk '/^[^[].+[^\n]$/ { system( \ htpasswd -b passwd.real $1 $3 ) }' $PWF Ehud. -- Ehud Karni Tel: +972-3-7966-561 /\ Mivtach - Simon Fax: +972-3-7966-667 \ / ASCII Ribbon Campaign Insurance agencies (USA) voice mail and X Against HTML Mail http://www.mvs.co.il FAX: 1-815-5509341 / \ GnuPG: 98EA398D http://www.keyserver.net/Better Safe Than Sorry = To unsubscribe, send mail to [EMAIL PROTECTED] with the word unsubscribe in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]
And in unrelated news - Sun releases JDK under the GPL
--=-ZsO0KUhEhfDGBnOEuBju Content-Type: text/plain Content-Transfer-Encoding: 7bit https://openjdk.dev.java.net/ Which possibly means I should be able to download the sources and compile them, but in the instructions for downloading and building the Hotspot VM, I can't seem to be able to checkout the sources from the openjdk subversion repository - I get prompted for a password, which is never mentioned anywhere in the FAQ. Has anyone had any success in building OpenJDK on Linux, maybe even by checking out the source from subversion ? -- Oded ::.. In every non-trivial program there is at least one bug. --=-ZsO0KUhEhfDGBnOEuBju Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 TRANSITIONAL//EN HTML HEAD META HTTP-EQUIV=Content-Type CONTENT=text/html; CHARSET=UTF-8 META NAME=GENERATOR CONTENT=GtkHTML/3.12.1 /HEAD BODY A HREF=https://openjdk.dev.java.net/;https://openjdk.dev.java.net//ABR BR Which possibly means I should be able to download the sources and compile them, but in the instructions for downloading and building the Hotspot VM, I can't seem to be able to checkout the sources from the openjdk subversion repository - I get prompted for a password, which is never mentioned anywhere in the FAQ. BR BR Has anyone had any success in building OpenJDK on Linux, maybe even by checking out the source from subversion ?BR BR TABLE CELLSPACING=0 CELLPADDING=0 WIDTH=100% TR TD --BR OdedBR ::..BR In every non-trivial program there is at least one bug.BR BR /TD /TR /TABLE /BODY /HTML --=-ZsO0KUhEhfDGBnOEuBju-- = To unsubscribe, send mail to [EMAIL PROTECTED] with the word unsubscribe in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]
Re: New line in bash variables pain
On 11/14/06, Maxim Vexler [EMAIL PROTECTED] wrote: [snip] san-svn:/var/lib/svn# for pair in `awk '/^[^[].+[^\n]$/ {print $1, $3}' passwd.fake`; do xargs $pair | echo; done san-svn:/var/lib/svn# for pair in `awk '/^[^[].+[^\n]$/ {print $1, $3}' passwd.fake`; do xargs $pair | echo -; done - Correction: The xargs line should look some thing like: san-svn:/var/lib/svn# for pair in `awk '/^[^[].+[^\n]$/ {print $1,$3}' passwd.fake`; do echo $pair | xargs echo ; done user1 password1 user2 password2 But as you can see, it still does not give the request output. -- Cheers, Maxim Vexler Free as in Freedom - Do u GNU ? = To unsubscribe, send mail to [EMAIL PROTECTED] with the word unsubscribe in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]
Re: New line in bash variables pain
What about something like following: while read line; do case x$line in x) # empty line, do nothing ;; x[ | x]) # you don't like brackets, do nothing too ;; *) # Everything else set -- $line # Now $1 == user, $3 == passwd (if any) # do whatever you like with them ;; esac done passwd.fake Valery --- Maxim Vexler [EMAIL PROTECTED] wrote: Hi list, any bash gurus in the house ? I'm having the most annoying issue with bash, one related to space delimited variables. I'd like to get a list in the form of : user1 password1 user2 password2 Instead I'm getting: user1 password1 user2 password2 Here's an example: san-svn:/var/lib/svn# cat passwd.fake [users] user1 = password1 user2 = password2 san-svn:/var/lib/svn# I'd like to automate this the import from this file into something like san-svn:# htpasswd -b passwd.real user1 password1 For this I've tried this voodoo: san-svn:/var/lib/svn# for pair in `awk '/^[^[].+[^\n]$/ {print $1, $3}' passwd.fake`; do htpasswd -b passwd.true $pair; done This does not work for the following reason: san-svn:/var/lib/svn# for pair in `awk '/^[^[].+[^\n]$/ {print $1, $3}' passwd.fake`; do echo $pair; done user1 password1 user2 password2 I've tried the following workarounds, that didn't worked: san-svn:/var/lib/svn# IFS='\n' for pair in `awk '/^[^[].+[^\n]$/ {print $1, $3}' passwd`; do echo $pair; done -bash: syntax error near unexpected token `do' san-svn:/var/lib/svn# IFS='!\n' for pair in `awk '/^[^[].+[^\n]$/ {print $1, $3}' passwd`;! do echo $pair;! done -bash: syntax error near unexpected token `do' san-svn:/var/lib/svn# for pair in `awk '/^[^[].+[^\n]$/ {print $1, $3}' passwd.fake`; do xargs $pair | echo; done san-svn:/var/lib/svn# for pair in `awk '/^[^[].+[^\n]$/ {print $1, $3}' passwd.fake`; do xargs $pair | echo -; done - I did found the following work around : san-svn:/var/lib/svn# for pair in `awk '/^[^[].+[^\n]$/ {print $1_$3}' passwd.fake`; do echo $pair | tr _ ' ' | cat; done user1 password1 user2 password2 But it's broken because _ can be a valid character in a password / usernmae name and besides - I'd to find a smarter solution. Any help / pokes to right direction would be highly appreciated. Thank you, Maxim. -- Cheers, Maxim Vexler Free as in Freedom - Do u GNU ? = To unsubscribe, send mail to [EMAIL PROTECTED] with the word unsubscribe in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED] Do you Yahoo!? Everyone is raving about the all-new Yahoo! Mail beta. http://new.mail.yahoo.com = To unsubscribe, send mail to [EMAIL PROTECTED] with the word unsubscribe in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]
Re: Shared Library entry point
Ami Chayun wrote: Hi all, I have a shared library, and I want a specific function to be called once the library is loaded. Dlls has the notorious DllMain function. Is there a method of achieving the same in an .so file? 5.2. Library constructor and destructor functions Libraries should export initialization and cleanup routines using the gcc __attribute__((constructor)) and __attribute__((destructor)) function attributes. See the gcc info pages for information on these. Constructor routines are executed before dlopen returns (or before main() is started if the library is loaded at load time). Destructor routines are executed before dlclose returns (or after exit() or completion of main() if the library is loaded at load time). The C prototypes for these functions are: void __attribute__ ((constructor)) my_init(void); void __attribute__ ((destructor)) my_fini(void); Shared libraries must not be compiled with the gcc arguments ``-nostartfiles'' or ``-nostdlib''. If those arguments are used, the constructor/destructor routines will not be executed (unless special measures are taken). http://www.faqs.org/docs/Linux-HOWTO/Program-Library-HOWTO.html#INIT-AND-CLEANUP -- Gilad Ben-Yossef [EMAIL PROTECTED] Codefidence. A name you can trust(tm) Web: http://codefidence.com | SIP: [EMAIL PROTECTED] IL: +972.3.7515563 ext. 201 | Fax:+972.3.7515503 US: +1.212.2026643 ext. 201 | Cel: +972.52.8260388 Resistance was futile. -- Danny Getz, 2004. = To unsubscribe, send mail to [EMAIL PROTECTED] with the word unsubscribe in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]
Re: Shared Library entry point
* Ami Chayun [EMAIL PROTECTED] [061114 16:48]: Hi all, I have a shared library, and I want a specific function to be called once the library is loaded. Dlls has the notorious DllMain function. Is there a method of achieving the same in an .so file? Check the document at http://people.redhat.com/drepper/dsohowto.pdf it is titled How To Write Shared Libraries and check section 1.5.6 on Running the Constructors. void __attribute((constructor)) my_init_func(void) { } Is what you want, but you should be reading that text anyhow to better understand shared libraries and how to write them. Baruch = To unsubscribe, send mail to [EMAIL PROTECTED] with the word unsubscribe in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]
Re: New line in bash variables pain
On Tuesday 14 November 2006 12:34, Ehud Karni wrote: I don't understand why all this voodoo is needed. If you have a list of spaced delimited values and want to use a for or while loop to read them, just fix $IFS locally (the default of IFS is tab or space or newline). You can make $IFS only be newline for the local process (IFS=something; your for loop here), and it will work. If that is too much (man bash), then you can just use awk. I am not sure why the '/^[^[].+[^\n]$/' gives you what you want, since you have not said much about your input (except a hint that it may be in the shape of user = password). More information about your input is needed in order to formulate the right awk recipe for you. --Ariel -- Ariel Biener, CISO Tel-Aviv University CIT div. e-mail: [EMAIL PROTECTED] phone: 03-6406086 PGP key:http://www.tau.ac.il/~ariel/pgp.html = To unsubscribe, send mail to [EMAIL PROTECTED] with the word unsubscribe in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]
Re: Novell and Microsoft
On Tuesday 14 November 2006 02:45, Amit Aronovitch wrote: I'll be happier if you convince me that this is all completely wrong... How can one convince you that your prophecy of something that has not happened yet is wrong ? It may be true, and then again, it may be not true. No one knows. If you want to hear what my hunches are, I think you're overly worried, and I am not sure for how long Novell and Microsoft's interests are going to coincide. This marriage is an unholy marriage, and the bride was probably not the first choice of the groom. In my opinion, no virtualization platform available today is a real choice for high powered servers. It's nice for developers, and servers that are doing little (especially when I/O bound processing is in question). Since I don't see yet a virtualization platform that really threatens the dedicated servers world, and since the 1U high powered servers platform prices decrease all the time, I am not sure why all this hooha was made of this agreement. Just FYI: A vmware license would cost minimum $4000 for the basic 2CPU server. A server which you can run say, 10 machines on, with good performance per machine would be a 16GB 2xquad core CPU machine, with at least 2 gbit/s interfaces available. It would require 15k rpm disks, or if using a central storage to hold the OSs on, a 4gbit/s interface for fibre-channel or a bundle of at least 2xgigabit/s iscsi. Assuming this server would cost some $12,000, and the VMware license some $4000-$6000, and yearly maintenance of some $2000, this deal costs in 3 years at least $22,000 (one should also include the maintenance on the server itself, probably some 8-12%, which makes it a total of $24k). (prices will probably be higher for commercial companies, the prices we get in the academia are better). For $24k, you can buy 10 DL360 machines from HP, and have פחת on all the sum, and of course get better performance, alot better redundancy, and less problems. If you wanted to have good redundancy as well, you'd need two VMware machines, and 2 vmotion licenses, and a central iSCSI or fibrechannel storage. The VMware/XEN/whatever bundle is not good for servers. It's good for engineering/software companies that want to create and dismantle debug/test environments on the fly, without the need to buy hardware and wait for purchase. It is good for such development projects and test environments, and also for servers that don't do much, and then you can load 20-30 machines on the server I described above, without worrying about redundancy, since the services are not mission critical, and as such, no need for 2 VMware servers and vmotion. --Ariel -- Ariel Biener e-mail: [EMAIL PROTECTED] PGP: http://www.tau.ac.il/~ariel/pgp.html To unsubscribe, send mail to [EMAIL PROTECTED] with the word unsubscribe in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]
OT: SparcStation monitor needed
Hello, does someone has an unused SparcStation Monitor to sell/giveaway? please contact me off-list to this address. TIA -- Regards, shay = To unsubscribe, send mail to [EMAIL PROTECTED] with the word unsubscribe in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]
Re: OT: SparcStation monitor needed
We used a regular VGA monitor. Maybe you need an adapter cable. - yba On Tue, 14 Nov 2006, Yehoshua (Shay) O'Hayon Suchar wrote: Date: Tue, 14 Nov 2006 14:45:41 +0200 (IST) From: Yehoshua (Shay) O'Hayon Suchar [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: OT: SparcStation monitor needed Hello, does someone has an unused SparcStation Monitor to sell/giveaway? please contact me off-list to this address. TIA -- EE 77 7F 30 4A 64 2E C5 83 5F E7 49 A6 82 29 BA~. .~ Tk Open Systems =}ooO--U--Ooo{= - [EMAIL PROTECTED] - tel: +972.2.679.5364, http://www.tkos.co.il - = To unsubscribe, send mail to [EMAIL PROTECTED] with the word unsubscribe in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]
Shared Library entry point
Hi all, I have a shared library, and I want a specific function to be called once the library is loaded. Dlls has the notorious DllMain function. Is there a method of achieving the same in an .so file? Ami = To unsubscribe, send mail to [EMAIL PROTECTED] with the word unsubscribe in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]
Re: Shared Library entry point
Yes, see this: http://tldp.org/HOWTO/Program-Library-HOWTO/miscellaneous.html#INIT-AND-CLEANUP Ami Chayun wrote: Hi all, I have a shared library, and I want a specific function to be called once the library is loaded. Dlls has the notorious DllMain function. Is there a method of achieving the same in an .so file? Ami = To unsubscribe, send mail to [EMAIL PROTECTED] with the word unsubscribe in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED] = To unsubscribe, send mail to [EMAIL PROTECTED] with the word unsubscribe in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]
Living in a Community Presentation on 19-November-2006 in Telux (W2L)
Hi all! On Sunday, 19-November-2006 , the Tel Aviv Linux club will hold its Living in the Community presentation as part of the Welcome to Linux presentation series. The presentation will take place at 18:30 in room Shenkar 222 (Physics Astronomy Building) of Tel Aviv University. The presentor will be Ori Idan. The material for the slides can be found here: http://www.cs.tau.ac.il/telux/lecture-notes/how-to-ask-questions-the-smart-way.sxi After the Welcome-to-Linux series, we would like to resume our regular presentations, and so if you have an idea for a presentation, please let us know. Regards, Shlomi Fish - Shlomi Fish [EMAIL PROTECTED] Homepage:http://www.shlomifish.org/ Chuck Norris wrote a complete Perl 6 implementation in a day but then destroyed all evidence with his bare hands, so no one will know his secrets. = To unsubscribe, send mail to [EMAIL PROTECTED] with the word unsubscribe in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]
Re: And in unrelated news - Sun releases JDK under the GPL
Oded Arbel wrote: --=-ZsO0KUhEhfDGBnOEuBju Content-Type: text/plain Content-Transfer-Encoding: 7bit https://openjdk.dev.java.net/ Which possibly means I should be able to download the sources and compile them, but in the instructions for downloading and building the Hotspot VM, I can't seem to be able to checkout the sources from the openjdk subversion repository - I get prompted for a password, which is never mentioned anywhere in the FAQ. Has anyone had any success in building OpenJDK on Linux, maybe even by checking out the source from subversion ? If you're using netbeans, there's a guide getting javac (and probably HotSpot as well) sources via netbeans update center: http://nb-openjdk.netbeans.org/get-and-build.html You can also download the zip bundles: https://openjdk.dev.java.net/hotspot/ Haven't used dev.java.net in a while. IIRC you can use the username guest and an empty password to checkout from svn. Otherwise the username/pass are the ones you've registered at dev.java.net (assuming you did that). Cheers -- Meir Kriheli = To unsubscribe, send mail to [EMAIL PROTECTED] with the word unsubscribe in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]
Re: New line in bash variables pain
On Tuesday, 14 בNovember 2006 22:31, Maxim Vexler wrote: Thanks to everyone for the help, all solution worked. To sum up the tips: Hey, what's the rush? I didn't have my take yet ;-) Let's do it in simple one liner: sed -e N -e 's/\n/ = /' passwd.fake Cheers, -- Oron Peled Voice/Fax: +972-4-8228492 [EMAIL PROTECTED] http://www.actcom.co.il/~oron ICQ UIN: 16527398 Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald E. Knuth = To unsubscribe, send mail to [EMAIL PROTECTED] with the word unsubscribe in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]
Re: And in unrelated news - Sun releases JDK under the GPL
On Tuesday, 14 בNovember 2006 21:26, Meir Kriheli wrote: Oded Arbel wrote: https://openjdk.dev.java.net/ Excellent news, but let's have some fun as well. Browsing the svn I stumbled by mistake on: https://openjdk.dev.java.net/source/browse/openjdk/compiler/trunk/LICENSE?view=markup Hmmm turns out that openjdk.dev.java.net is written in... -- Oron Peled Voice/Fax: +972-4-8228492 [EMAIL PROTECTED] http://www.actcom.co.il/~oron ICQ UIN: 16527398 The most exciting phrase to hear in science, the one that heralds new discoveries, is not Eureka! (I found it!) but That's funny ... -- Isaac Asimov = To unsubscribe, send mail to [EMAIL PROTECTED] with the word unsubscribe in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]
Re: And in unrelated news - Sun releases JDK under the GPL
ביום שלישי 14 נובמבר 2006, 23:35, כתבת: On Tuesday, 14 בNovember 2006 21:26, Meir Kriheli wrote: Oded Arbel wrote: https://openjdk.dev.java.net/ Excellent news, but let's have some fun as well. Browsing the svn I stumbled by mistake on: https://openjdk.dev.java.net/source/browse/openjdk/compiler/trunk/LICENSE?v iew=markup Hmmm turns out that openjdk.dev.java.net is written in... The site is broken now. (viewcvs has it's issues I assume) I started downloading this at about 11:00 AM (how the hell did I got it that early...) and I found that most of the code is java. But there are some parts of the code written in c++ (some even using printf for debug), and I find the code very clear and well written. I was expecting to see ugly source code (want to see ugly code? look into dosemu, a very messy source code). If I were able to build the source, I would be impressed :) (were the hell is configure...? cmake... I am not even seeing qmake!) -- diego, kde-il translation team - http://il.kde.org Please avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/no-word-attachments.html = To unsubscribe, send mail to [EMAIL PROTECTED] with the word unsubscribe in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]
Re: OT: SparcStation monitor needed
On Tuesday 14 November 2006 16:01, Jonathan Ben Avraham quoth: We used a regular VGA monitor. Maybe you need an adapter cable. I can probably give or lend you an adapter. you need a fairly capable (Hz/KHz/MHz-wise) monitor I'd use a serial cable M -- ---MAV Marc A. Volovic Linguists do it cunningly = To unsubscribe, send mail to [EMAIL PROTECTED] with the word unsubscribe in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]
Re: And in unrelated news - Sun releases JDK under the GPL
On 15/11/06, Meir Kriheli [EMAIL PROTECTED] wrote: Haven't used dev.java.net in a while. IIRC you can use the username guest and an empty password to checkout from svn. Yup. Confirmed. User guest and an empty password and browsing it beautifully through kdesvn. Thanks for the tip, I didn't feel like messing around to retrieve my java.sun.com username/password. Cheers, --Amos