marc3825
marc3825

Reputation: 3

Apply consecutive patch to a file in shell script

I'm doing a little versioning system in shell for school. The teacher tell us to use seq but I didn' t find how to use it. I've:

patch $2 .version/$2.{`seq -s"," 2 $3`}

where $2 is the file I need to patch, .version/$2. are the patch I need to apply, from 2 ($2.2) to the argument specified ($2.$3). It return:

patch: **** Can't open patch file .version/test.sh.{2,3} : No such file or directory

So it seems the seq is good, but patch didn't interpret it. test.sh.2 and test.sh.3 exist.

Is there a way to do it like this or am I in the wrong direction?

Sorry for the english, it's not my native language.

Upvotes: 0

Views: 1206

Answers (1)

Thomas Dickey
Thomas Dickey

Reputation: 54583

According to its manual page, patch expects one patch-file at a time. You might redo your example like this:

for n in `seq 2 $3` ; do patch $2 .version/$2.$n; done

The reason for the -s option is unclear, so I removed it as well.

Upvotes: 0

Related Questions