You've got a lot of code here that's essentially repeated. I would look at doing this another way, such as putting it in a function maybe and having a common error message. "Invalid PKGBUILD ID specified." or something.