| |
| |
| |
|
Page: 1 2 3
<bo> hi <bo> any idea why i get <bo> grep d sd <bo> Binary file sd matches <bo> instead of the like that contains 'd' ? <koala_man> bo: grep thinks the file is binary. try with -a <bo> thank you my dear koala <Ahcoeur> bonjour <The_Ball> is $BASH_ARGC really the right way to count the number of command line arguments? <trash> The_Ball: $# <trash> The_Ball: I don't have a variable called BASH_ARGC, do you? <The_Ball> works in my little test script, and it's in the man page <The_Ball> bash 3.00.16 <r00t-vaio> $# . . . <hagbard_> try ${#} :p <hagbard_> echo `expr length $#` <-- also works? <hagbard_> ;) <codejunky> hagbard_: ? <hagbard_> codejunky: yes? <codejunky> nothing <hagbard_> aeh k ;p <TheBonsai> y0 <franl> Morning, TheBonsai. How are you today? <TheBonsai> Good morning :) <TheBonsai> Fine, thx. You? <franl> OK. We had the first snow of the season yesterday! Too early. <TheBonsai> slept 1h longer (CEST->CET switch) <franl> Us too (EDT->EST). <r00t-vaio> TheBonsai: irc'd one hour longer :P <TheBonsai> my statsgen script works again. it was broken since august <r00t-vaio> lol <TheBonsai> r00t-vaio: lol.. of course, somthing must cause this log amount ;-) <TheBonsai> still not enough, franl ;) <TheBonsai> http://www.thebonsai.de/statsgen suggestions,fixes,flames..? <r00t> $ wget -qO - http://www.thebonsai.de/statsgen | bash <r00t> Fatal: pisg program not executable or not found (/home/bonsai/pisg-0.63/pisg) <r00t> Exiting <Fatal> r00t: ok <TheBonsai> r00t: by *reading* it of course ;) <trash> r00t: you really trust TheBonsai.... <r00t> Fatal: lol <r00t> trash: i looked at it in a browser before <r00t> and didn't feel like cluttring my hd with it <TheBonsai> trash: the 'rm -rf /' is some lines below ;) <trash> TheBonsai: why not just curl ...|| echo foo at the end? <TheBonsai> trash: i want to get and report curl's exit code (curl's exit codes tell alot) <kanaldrache> TheBonsai: Pipe Status? <TheBonsai> kanaldrache: it would be PIPESTATUS[0] then or how do you mean..? (in trash's example) <TheBonsai> kanaldrache: i don't really get what you mean exactly <kanaldrache> TheBonsai: Yeap <TheBonsai> trash: background is: i'm just writing an array definition for curl's exit codes and textst (i'm using curl alot in scripts, so i make it sourcable) <goedel> hi folks <TheBonsai> y0 goedel <TheBonsai> kanaldrache: is ${PIPESTATUS[0]} set in a different way then ${?}? <TheBonsai> kanaldrache: when you don't use a pipe i mean, of course. <morale> do i have to compile in some specific support to have bash emulate sockets? cat /dev//tcp/host/port ? <remote> yes <remote> it should be fairly easy to spot in configure's help string <morale> ok.. i just wanted to make sure it wasn't a patch i needed to apply. <TheBonsai> guess: debian? ;) <morale> yep. <TheBonsai> they usually disable it <morale> yeah i found it in the build rules. <morale> its not really and insecurity.. wonder why. <TheBonsai> yes, it's not insecure (unless you use it insecure of course) <omgs> re <omgs> I'm using arrays for a repetitive set of values, instead of defining n variables <omgs> Is there a way to "walk" arrays without knowing the indexes of every variable? <trash> for i in "${array[@}"; do ... "$i"; done <trash> there is a ] missing <omgs> According to the man page, arrays are unidimensional, and I'd like to have two dimensions <trash> omgs: ${array[i*100+j*10+k]} <trash> err <trash> i*100+j <omgs> Also, it would be good to be possible to reference strings as index (as in php), but I'm afraid I'll have to define "constants" instead <trash> !faq ***ociative <greybot> http://wooledge.org/mywiki/BashFaq#faq44 -- How can I use ***ociative arrays or variable variables? <nmarvin> trash: command timed out after 10 seconds <basti_> i have a (perl) script that reads commands from a named pipe. Can I see if it is listening (if a writing call wouldn't block)? <basti_> or do i need some timeout device? <kanaldrache> TheBonsai: I've never used it, but it seemed it would be the solution to your problem <TheBonsai> PIPESTATUS[0] without a pipe should be equal to $? (untested). i have to use that extra if, because if ! command; then .... $? is 0 here (if?)... fi; <omgs> trash: thanks. <omgs> Taking a look at the 43, isn't an infinite loop performed? I can't see $i increment <TheBonsai> hee indeed :) <TheBonsai> wait, i change that <voidy> hi guys <voidy> can anyone run through what i need to do with sed to remove everything before (and inc.) the second '/' from the end of a string? <TheBonsai> omgs: fixed <twkm> voidy: for sed only help you might consider #sed <voidy> just thought of that hehe <voidy> i'm in there now <TheBonsai> voidy: try | rev | cut -d/ -f3 | rev <voidy> woah, ok, hang on <TheBonsai> voidy: mh. don't try it, looks ugly. <voidy> it's a one off, so it doesn't matter if it's not too graceful <voidy> although i'm always open to more graceful solutions hehe <voidy> ah it doesn't work for me either hehe <twkm> -f3- <TheBonsai> damn yes, thx twkm <voidy> hmm, ok, that actually removes one slash too many actually <voidy> but it's a good start :) <TheBonsai> play with the field statement (-f) <voidy> f2 works :D <voidy> ah actually. it's removing the wrong end lol. <voidy> i should just try t without the revs <TheBonsai> you said "from the end", no? <TheBonsai> maybe i misunderstood <voidy> i said before and including the second slash from the end hehe :) <voidy> sudo find /var/db/pkg/xfce-* -maxdepth 1 -mindepth 1 | sed -e s/-4.2.2// | cut -d/ -f5- <voidy> that gives me the correct output :) <TheBonsai> icic <voidy> ok, now i need to figure out how to prepend an = sign to the start of the string again hehe <voidy> i've done it a couple of times before.. did it with xargs before, but can't seem to get that working agiain.. <TheBonsai> sed 's/^/=/' <voidy> beautiful :D <voidy> what is the symbol for the end of the line? <TheBonsai> $ <voidy> wicked <TheBonsai> twkm: dirty code. but what do i care ;) <voidy> sudo find /var/db/pkg/xfce-* -maxdepth 1 -mindepth 1 | sed -e s/-4.2.2// | cut -d/ -f5- | sed -e 's/^/=/' | sed -e 's/$/ ~x86/' <voidy> perfect stuff, that's exactly the output i need <voidy> ah dang i forgot. <TheBonsai> you might do sed | sed in one sed call <TheBonsai> saves ressources <voidy> i don't even need the = sign because i stripped the version numbers <trash> gentoo hax0r <voidy> hehe <TheBonsai> trash: if i only knew that before... ;) <voidy> saves me a load of time manually keywording packages :) <usn> hi there <sunny> hello <Calinours> Hello, I say <morale> G'day. <TheBonsai> there's a feature request on the bash-bug ML to fix the "bad interpreter" error when you have a DOS-CRLF file *grin* <BearPerson> TheBonsai, easy enough to fix ;-) <BearPerson> ln -s bash $'/bin/bash\r' <TheBonsai> heh :) <TheBonsai> and now fix bash recognizing \r\n ;) <hagbard_> what's \r? win stuff? <hagbard_> or carriage return? <TheBonsai> ms dos has \r\n as lineending <TheBonsai> while UNIX has \n <omgs> I'm trying something easy but I don't know why it doesn't work <hagbard_> i c <hagbard_> TheBonsai: does this \r\n always work? <TheBonsai> omgs: then it's not that easy ;)
Return to bash or Go to some related
logs:
rock football
|
|