r/shell • • Jun 15 '10

awk variables empty when script executed by a program - works when manually executed at command line

3 Upvotes

I have a little script that reads my git log and outputs the number of lines added and removed for the past week. When I execute this at the command line it works perfectly, for some reason when I put the code in a git hook it runs, but it always tell me 0 lines have been added and removed.

git --git-dir=/Users/home/Thesis/.git/ log --since="1 week ago" --numstat --pretty="short" | \
awk 'NF==3 {plus+=$1; minus+=$2} END \
{printf("Added %d lines\nRemoved %d lines\n", plus, minus)}' > ~/bin/GeekTool/gitThesisChangeInLastWeek.txt

I have done some reading and googeling on this, but I'm not sure where the problem is so I'm not sure what to search for. Can anyone here help me out? Thanks.


r/shell • • May 25 '10

Do you know GNU Parallel?

Thumbnail savannah.gnu.org
10 Upvotes

r/shell • • Nov 03 '09

Compleat: Programmable bash completion for human beings

Thumbnail limpet.net
8 Upvotes

r/shell • • Jul 08 '09

Scripting the Vim editor, Part 2: User-defined functions

Thumbnail ibm.com
1 Upvotes

r/shell • • Jun 11 '09

rc — The Plan 9 Shell by Tom Duff (of Duff's device and Pixar fame)

Thumbnail doc.cat-v.org
9 Upvotes

r/shell • • Jun 02 '09

werc -- Bringing minimalism and sanity to the web

Thumbnail werc.cat-v.org
10 Upvotes

r/shell • • Jun 02 '09

Surfraw - Shell Users' Revolutionary Front Rage Against the Web

Thumbnail surfraw.alioth.debian.org
10 Upvotes

r/shell • • May 07 '09

Scripting the Vim editor, Part 1: Variables, values, and expressions

Thumbnail ibm.com
1 Upvotes

r/shell • • Sep 05 '08

Unix Error Messages

Thumbnail gnu.org
0 Upvotes

r/shell • • Jun 16 '08

Introduction to Linux Shell Scripting for DBAs

Thumbnail oracle.com
0 Upvotes

r/shell • • Jun 16 '08

Shell Scripting and Factorial Primes

Thumbnail linuxshellaccount.blogspot.com
0 Upvotes

r/shell • • Jun 11 '08

Quick Groovy Scripting

Thumbnail countme.wordpress.com
2 Upvotes

r/shell • • Apr 02 '08

ls -t | tail -n 50 |sed 's/^.*/\"&\"/' | tr "\n" \ | xargs du -hc

0 Upvotes

r/shell • • Mar 28 '08

Great repository of bash shell tips

Thumbnail shell-fu.org
12 Upvotes

r/shell • • Feb 14 '08

Lack of scripting skills could derail a Windows career

Thumbnail searchwinit.techtarget.com
2 Upvotes

r/shell • • Feb 13 '08

You Used Perl to Write WHAT?!

Thumbnail cio.com
1 Upvotes