Quote variables as frequently as possible to prevent whitespace problems
[guilt.git] / guilt-header
blobeb89cfd602cab64e24e0296ed5980c9955ee5be2
1 #!/bin/bash
3 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
6 USAGE="[<patchname>]"
7 . guilt
9 if [ $# -gt 1 ]; then
10 usage
13 patch="$1"
15 if [ -z "$patch" ]; then
16 # use the patch that's on the top of the stack
18 eidx=`wc -l < $applied`
19 if [ $eidx -eq 0 ]; then
20 die "Status file is empty"
22 else
23 # use the specified patch
25 eidx=`get_series | grep -ne "^$patch\$" | cut -d: -f1`
26 if [ $eidx -eq 0 ]; then
27 die "Patch $patch is not in the series"
31 idx=0
32 for p in `get_series`; do
33 idx=`expr $idx + 1`
34 [ $idx -lt $eidx ] && continue
35 [ $idx -gt $eidx ] && break
37 do_get_header $GUILT_DIR/$branch/$p
38 done