@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13



Comments:

<0> heiner, and then i put the magic markers into that document
<1> after I changed it?
<2> working on lines is easy using sed and awk, but I'm not sure how to handle a whole paragraph at the same time, because it will come out as different records...
<3> sjau: i would just add that line at the begening of the script
<2> perhaps I should change the IFS?
<4> Languid: no, if you don't need to parse the document (because you get the values from the command line), there's no need to put markers in there
<0> heiner, ok
<1> redduck: thx for that :)
<2> heiner: are you of shelldorado?
<4> yes
<3> fluxdude_home: can you give an example text and in what you want to change.
<5> heiner: maybe you know something about it: if i read with a timeout, and the line of input it not complete, but it began, when the timer bangs, what happens? (or is the timer blocked when input comes?
<5> heiner: ich mein, nich d*** der TIMER im EIMER is... :)
<2> cool, nice web site, I'm trying to learn a lot from it, subscribed to newsletter and am attempting to go through your archives to learn from your obvious guru-ness in this stuff
<4> TheBonsai: I don't know, it probably depends on how the timeout is implemented
<2> heiner: thanks for all of us out there on the net who appreciate it...



<2> s/for/from/
<4> you're welcome ;)
<5> heiner: i tested it on prompt, the stdin gets written to kmy shell's stdin the. i wonder what happens with the fifo...
<5> heiner: can the data technically be "sent back" to the fifo if not needed?
<5> heiner: (streams can do that iirc)
<2> redduck666: it's html from a web page. I want to strip everything from Explanation: </b> ..several lines .. to <p>
<5> heiner: on terminal stdin it's "sent back"
<4> TheBonsai: sorry, I don't know what you mean exactly. Where does the FIFO come into the game?
<5> heiner: while read -t 5 ...... done <fifo
<4> TheBonsai: well, the fifo is buffered usually. It depends on how "read" handles its input
<3> fluxdude_home: sed -e '/text1/,/text2/d' should delete everything from a line containing 'text1' to a line containing 'text2'
<5> okay, i'll try to get a good solution out of my possibilities
<3> is this whta you are looking for?
<3> *what
<0> heiner, okay so i have the template in the file delimited with EOT, so how do i output it to a file, change the variables which need to be changed?
<2> redduck666: not delete, extract...
<2> sorry should have may that clearer..
<4> Languid: you can use the shell variables in the here-document
<5> heiner: ha, writing to the fifo is blocked until data is fetched - nice. that solves half of my sorrow (unrelated to the stuff above)
<3> fluxdude_home: changing 'd' to '!d' should delete everything BUT those lines
<4> Languid: cat <<EOT > outputfile
<4> ....
<4> EOT
<0> heiner, so i should change, for example, 'LOCAL_IP="10.10.0.7"' to 'LOCAL_IP="$local_ip"' in the EOT?
<4> correct
<0> cool :)
<4> it's easier than expected, isn't it? ;-)
<0> this is fancy :)
<4> Languid: you're lucky because you don't need to parse the old configuration file as input
<0> thank god
<0> yeah this is really just to automate the tedious editing of config files everytime we want to run a test on a different computer
<5> heiner: it's to communicate (send commands) with a daemon that runs in a big fat while true-loop. any other suggestions to talk to that daemon?
<2> redduck666: thanks, that takes of the bit I waas wondering about, I'll have a crack at the rest...
<4> TheBonsai: for shell scripts named pipes (FIFOs) are a good choice
<6> img getting an annoying "error" rigth now, i have "rm -f ~/.bash_history" in my .bash_logout but it doesnt seem to work anymore when i close my terminals, anyone got an idea about this?
<7> naturally.
<7> why are you removing your history?
<6> "feeling abit more secure" or some other crap
<8> r00tshell
<7> if it's crap, then don't worry that you get crap results too.
<5> heiner: i have a problem then: i can't loop that fast (it's slowed down by a sleep 120, because it executes some expensive commands), but that also means the read from the pipe will be 120 secs in worst case - something like that - trying to find a solution anyways.
<0> what's the easiest way to check that a file exists? running a 'touch' on the file and seeing if it returns a 0 status?
<5> *will be every 120 secs
<9> Languid: help test
<7> TheBonsai: load an array first?
<6> twkm: it has worked in 3 months but stoped one week ago
<7> Netfeed: oh well.
<6> i dont want other users to be able to see what im doing
<5> twkm: i don't get that.
<7> oh no!
<7> TheBonsai: if you don't want to delay reading the pipe, read it into a buffer (i suggest an array, so you can process line by line).
<5> eeeew
<7> TheBonsai: ahh, you want commands via that pipe.
<5> twkm: yea, that solution is quite okay. smart, too
<7> TheBonsai: have a sub-shell do your timing then write the pipe with a "just me saying to wake up" command.
<6> twkm: got any idea why it doesnt work?
<7> Netfeed: yes.
<0> i have an if statement in which im testing that a variable equals 1, and if "test -e filename" returns true, how would i combine those two using a logical and?
<5> twkm: hm sounds good. i was just thinking the wrong way round (put the reading into a subshell, but that's unusabble)
<4> !faq group.*expression
<10> No matches found at http://wooledge.org/mywiki/BashFaq



<3> Languid: [[ test1 && test2 ]]
<3> or [ test1 -a test2 ]
<3> (IIRC)
<5> heiner: nmarv putt?
<6> twkm: care to share it?
<0> redduck666, why the two brackets?
<7> Netfeed: not really.
<7> it's just crap.
<3> Languid: it allows you some neat tricks, one of them is using '&&' as AND.
<6> twkm: so kind of you
<4> TheBonsai: I updated from SuSE Linux 9.2 to 10.1, and now apache/php/mysql/sendmail/netsnmp/subfs are no longer working :-(
<4> TheBonsai: the list of services that does *not* run is still getting larger
<4> <sigh>
<7> 100 impressed me. 10.1 did not.
<11> heiner: "ugh" :-(
<7> err, 10.0
<4> well, php is almost fixed, working on MySQL
<5> twkm: does something like.... sleep 100 & ZZZ_PID=$!; while kill -0 $ZZZ_PID; do <pipestuff>; done sound sane?
<5> (just came off from my head, i didn't touch the editor since your last statements)
<7> seems workable.
<5> ***umes the OS ***igns PIDs in a sane way, though ;)
<5> i hate ***umptions
<0> any idea why this isn't work?: if [ $BACKUP_OLD_CONFIG=1 && test -e Config.py ]
<5> SPACES
<5> [ is a command
<5> it wants arguments
<5> arguments are separated by spaces
<5> [ foo = bar ]
<5> and && within [ will break
<6> twkm: "rm -f /home/netfeed/.bash_history" worked, whats the difference?
<0> so then how should it look?
<5> -> test -e Config.py <-
<5> [ IS test
<5> the command "[ foo ]" *IS* the command "test foo"
<0> ah okay i get it
<0> thank you sir :)
<5> so all descriptions for the test command apply to [
<5> PLUS the mandatory ]
<2> how do I collapse mutiple lines in a pipe into a single line?
<12> use a regex to remove all new lines and replace them with a space or something?
<12> | sed -e 's/\n/ /' |
<12> something similar to that
<12> i don't know if that'll work..
<12> it think it does it line by line anyway.. there's a sed option somewhere that could help..
<2> voidy: tried that already but lines still came out looking like before, even if \n is stripped they still come out as individual lines...
<2> i think so too, trying to find that option now...
<9> tr -s '\n' ' '
<9> maybe.
<0> heiner, okay so i created the template, and put the line 'cat << EOT > Config.py' into the script, but now when i run it i get an error like this for each line: ./test: line 57: LOCAL_PORT: command not found
<0> hey so this EOT thing isnt working, can someone help me
<2> goldfish: very close -d does it!
<2> made me wonder why you were doing -s and then I found -d and it works gloriously well and easily. Thanks!
<0> anyone here have experience using here-document
<9> Well, i thought he wanted to change them into spaces.
<9> hence the -s, anyways, you got it!
<4> Languid: could you show us what you have (in a paste bin)?
<0> yessir!
<0> http://rafb.net/paste/results/FBmbPJ59.html
<4> Languid: you need the "cat" part
<4> Languid: cat <<EOT > outputfile
<4> ....
<4> EOT
<0> oh
<0> so add those two lines to the bottom on the document?
<13> heiner: the proper way: http://rafb.net/paste/results/298lD438.html ... in the meantime, I worked it around
<13> but this is how it should work using your stdout/stderr trick
<4> Languid: the "cat" line needs to be at the beginning
<0> oh, before the whole document?
<5> http://thebonsai.pastebin.ca/114104 - somehow it doesn't work, it seems the read blocks - snipplet, actually enclosed in a while true-loop
<4> iSteve: excellent
<5> after it actually read something, it continues in the inner while-loop (kill -0)
<5> weird
<5> no


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #bash
or
Go to some related logs:

#oe
bebo let me parse
fedora mod_bw howto
ZMD does not appear to be running
bitbake1.6
gnome-power-manager + swsusp2
#ldap
#mysql
why dapper cannot recognize cable modem
kernel-sources-2.6.16.2



Home  |  disclaimer  |  contact  |  submit quotes