From 2cffa7b45583a7b92c91e3d652b64f443355baa4 Mon Sep 17 00:00:00 2001 From: Tiejun Chen Date: Wed, 21 Feb 2018 14:19:52 -0800 Subject: [PATCH] Add one script to get patches prefixed by the term of number Signed-off-by: Tiejun Chen --- scripts/prefix-with-number.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 scripts/prefix-with-number.sh diff --git a/scripts/prefix-with-number.sh b/scripts/prefix-with-number.sh new file mode 100755 index 000000000..e49915b61 --- /dev/null +++ b/scripts/prefix-with-number.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# This can help get patches prefixed by the term of number. +# +# Just please list all patches in the file "series" orderly, and then run this +# script directly. +# +# $ cat series +# $ xxxx.patch +# $ yyyy.patch +# $ zzzz.patch +# $ ./prefix-with-number.sh +# $ ls -l +# 0001-xxxx.patch +# 0002-yyyy.patch +# 0003-zzzz.patch +# +i=0000 +for line in `sed -e "s/#.*//g" series`; do + i=$(expr $i + 1) + a=$((10000+$i)) + mv $line ${a:1}-$line +done;