File: move-to-front

package info (click to toggle)
patchutils 0.4.2-1
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, forky, trixie
  • size: 1,248 kB
  • sloc: ansic: 6,181; sh: 6,143; xml: 2,750; perl: 409; makefile: 248; python: 23
file content (25 lines) | stat: -rwxr-xr-x 441 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
if [ "$#" -eq 0 ] || [ "x$1" == "x--help" ]
then
  echo "usage: move-to-front [PATCHES..] PATCH"
  exit 0
fi

# Dry-run.
eval "patch2=\${$#}"
i=$(($# - 1))
while [ $i -gt 0 ]
do
  eval "patch1=\${$i}"
  flipdiff $patch1 $patch2 >/dev/null || exit $?
  i=$(($i - 1))
done

# Do it for real.
i=$(($# - 1))
while [ $i -gt 0 ]
do
  eval "patch1=\${$i}"
  (set -x; flipdiff --in-place $patch1 $patch2) || exit $?
  i=$(($i - 1))
done