[Novalug] bash pause

Jeremy Hoel jthoel@gmail.com
Wed Dec 4 19:06:01 EST 2013


While i get the perl script works, the bash script seems to be more
readable and easier to understand.. even though it doesn't work.

Nice to see both forms. Good stuff.

On Wed, Dec 4, 2013 at 11:51 PM, shawn wilson <ag4ve.us@gmail.com> wrote:
> Ugh, why do I even mess with bash... So annoying:
>
> perl  -nle 'next if (/^[ \+]*[:\*]/); push @file, $_; my @f = split("
> ", $_); $names{$f[1]} = 1; }{ for my $key (keys %names) {print
> "\n\n\n[$key]\n"; print map {"$_\n"} grep {/-a $key/} @file; $pause =
> <>;}' ipt.diff
>
> done
>
> On Wed, Dec 4, 2013 at 5:55 PM, Richard Rognlie <rrognlie@gamerz.net> wrote:
>> On Wed, Dec 04, 2013 at 05:51:05PM -0500, shawn wilson wrote:
>>> Any idea why read isn't pausing the loop to prompt me here?
>>>
>>> cat ipt.diff | while read f; do if echo "$f" | egrep -q '^ ?[:\*]';
>>> then continue; fi; echo $f | awk -F' ' '{print $2}' | xargs -i{} grep
>>> {} ipt.diff; read -p; clear; done
>>
>> Because read is against stdin... which since you have piped "cat ipt.diff"
>> to the while loop... $f will be the contents of the file ipt.diff... one
>> line at a time.
>>
>>
>>
>> --
>>  /  \__  | Richard Rognlie / Code Slinger For Hire / Gamerz.NET Lackey
>>  \__/  \ | http://www.gamerz.net/~rrognlie    <rrognlie at gamerz.net>
>>  /  \__/ | Creator of pbmserv@gamerz.net
>>  \__/    |                Helping reduce world productivity since 1994
> _______________________________________________
> Novalug mailing list
> Novalug@calypso.tux.org
> http://calypso.tux.org/mailman/listinfo/novalug



More information about the Novalug mailing list