RE: bash while read question
2010/5/5 CyberLeo Kitsana cyber...@cyberleo.net: On 05/05/2010 08:25 PM, Evuraan wrote: I cant figure out why the variable in in loop2 does not hike to +1? (its a friday, i am dazed, I admit. but this should not be a mystery!) any help would be much appreciated. snip $ cat loop2 #! /bin/bash date /tmp/somefile b=1 cat /tmp/somefile | while read blah; do let b=(b+1) done echo variable is $b This particular syntax executes the 'while' block in a subshell. The variables set or altered in the subshell are never propagated back up to the parent shell. duh, i get it now, anytime stuff is piped , a subshell is evoked: http://tldp.org/LDP/abs/html/subshells.html says, snip Redirecting I/O to a subshell uses the | pipe operator, as in ls -al | (command). /snip thanks for the reset..! -- Fuzzy love, -CyberLeo ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
bash while read question
I cant figure out why the variable in in loop2 does not hike to +1? (its a friday, i am dazed, I admit. but this should not be a mystery!) any help would be much appreciated. $ cat loop1 #! /bin/bash date /tmp/somefile b=1 while read blah; do let b=(b+1) done /tmp/somefile echo variable is $b $ cat loop2 #! /bin/bash date /tmp/somefile b=1 cat /tmp/somefile | while read blah; do let b=(b+1) done echo variable is $b $ ./loop1 variable is 2 $ ./loop2 variable is 1 ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
bsdlabel size mismatch
On a FreeBSD 7.2 machine, I've a ~1TB drive as /dev/da0: da0: 953664MB (1953103872 512 byte sectors: 255H 63S/T 121575C) the lone slice is of ~19G (per df) yet bsdlabel shows that it is spanning the entire drive. also notice how it says unused despite it really being an ufs FS. [r...@evu ~]# df -h / Filesystem SizeUsed Avail Capacity Mounted on /dev/da0s1a 19G1.2G 17G 7%/ [r...@evu ~]# bsdlabel /dev/da0s1 # /dev/da0s1: 8 partitions: #size offsetfstype [fsize bsize bps/cpg] a: 1953102296 16unused0 0 c: 19531023120unused0 0 # raw part, don't edit needless to say, i cannot edit and add a new partition as a seems to be spanning the entire disk according to bsdlabel at least. any advise on this would be much appreciated. I am looking to alloc a 16G swap, and add a couple of ufs filesystems to da0. many thanks in advance. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: scripting tip needed
good thing you found the answer. I am glad you did, and oh, I am more glad that you found your solution on ksh itself and not on advanced scripting language, like Perl or Python.'' Guys, I eventually found it with lots of rtfm on variable substitution and such.. [...@dada~]$ z=0 [...@dada~]$ y=1 [...@dada~]$ x=aaa [...@dada~]$ eval `echo MACHINE_DISK$z[$y]`=$x [...@dada~]$ echo $(eval echo \${MACHINE_DISK$z[$y]}) aaa [...@dada~]$ Thanks anyway! -- ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
awk question (actively tail a file notify when expression is found)
Greetings..! this works, tail -f /var/log/apache2/access.log | nawk '/192.168.1.100/{ print $0 }' and this too: tail -f /var/log/apache2/access.log |awk ' /192.168.1.100/ { system (mail -s \This works\ m...@email.address)}' but this below, does not work tail -f /var/log/apache2/access.log |awk ' /192.168.1.100/ { print $0 | mail m...@email.address }' Any pointers would be much appreciated. Thx. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: awk question (actively tail a file notify when expression is found)
nevermind, i got it to work, with a little help from http://student.northpark.edu/pemente/awk/awk_sys.txt, tail -f /var/log/apache2/access.log | awk '/192.168.1.100/ {system(echo $0 | mailx -s test_email m...@email.com ) }' thx..! 2009/4/22 Bill Campbell free...@celestial.com: You might want to look at ``swatch'' which is designed to do this, and monitors multiple log files simultaneously. On Wed, Apr 22, 2009, Evuraan:: wrote: Greetings..! this works, tail -f /var/log/apache2/access.log | nawk '/192.168.1.100/{ print $0 }' and this too: tail -f /var/log/apache2/access.log |awk ' /192.168.1.100/ { system (mail -s \This works\ m...@email.address)}' but this below, does not work tail -f /var/log/apache2/access.log |awk ' /192.168.1.100/ { print $0 | mail m...@email.address }' Any pointers would be much appreciated. Thx. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org -- Bill -- INTERNET: b...@celestial.com Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way Voice: (206) 236-1676 Mercer Island, WA 98040-0820 Fax: (206) 232-9186 Skype: jwccsllc (206) 855-5792 Capitalism works primarily because most of the ways that a company can be scum end up being extremely bad for business when there's working competition. -rra ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
distributed shell (dancers shell)
How/where can I get dsh for Freebsd? attempts to compile it afresh have been failing, hence this question. thx. checking for endnetgrent... yes checking for open_dshconfig in -ldshconfig... no configure: error: dshconfig not found!! ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]