blob: 963fbabf02591339ff56176118c69e52d39e8a97 (
plain)
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
26
|
#!/bin/sh
# savepatch -- save patch on standard in
if [ -z "$1" ]; then
echo "usage: ${0##*/} patch-name" 1>&2
exit 1
fi
dir=$(whereispatch -i)
mkdir -p "$dir"
read -r first
if [ -e "$dir/$1" ]; then
printf "%s: %s already exists; overwrite? " \
"${0##*/}" "${dir#/home/*/patches/}/$1" 1>&2
read ans </dev/tty
case $ans in
y*) ;;
*) exit 1 ;;
esac
fi
{ echo "$first"; cat; } > "$dir/$1"
echo "$dir/$1"
|