On Wed, Nov 02, 2011 at 05:52:20PM -0700, Linus Arver wrote: > Some vcs prototypes do something like > > cd repo && update > > while others do it like > > cd repo > update > > to update an existing repo. It makes sense to have them all do it the > second way, because the code is already inside an if block that checks > if the repo directory exists.
Except that there's no reason not to go with the first form... cd'ing in a script without checking the result is bad form. > Signed-off-by: Linus Arver <[email protected]> > --- > prototypes/PKGBUILD-bzr.proto | 3 ++- > prototypes/PKGBUILD-git.proto | 3 ++- > prototypes/PKGBUILD-svn.proto | 3 ++- > 3 files changed, 6 insertions(+), 3 deletions(-) > > diff --git a/prototypes/PKGBUILD-bzr.proto b/prototypes/PKGBUILD-bzr.proto > index 24eebe4..a01eea8 100644 > --- a/prototypes/PKGBUILD-bzr.proto > +++ b/prototypes/PKGBUILD-bzr.proto > @@ -35,7 +35,8 @@ build() { > msg "Connecting to Bazaar server...." > > if [[ -d "$_bzrmod" ]]; then > - cd "$_bzrmod" && bzr --no-plugins pull "$_bzrtrunk" -r "$pkgver" > + cd "$_bzrmod" > + bzr --no-plugins pull "$_bzrtrunk" -r "$pkgver" > msg "The local files are updated." > cd .. > else > diff --git a/prototypes/PKGBUILD-git.proto b/prototypes/PKGBUILD-git.proto > index 22eba7a..88bc76b 100644 > --- a/prototypes/PKGBUILD-git.proto > +++ b/prototypes/PKGBUILD-git.proto > @@ -35,7 +35,8 @@ build() { > msg "Connecting to GIT server...." > > if [[ -d "$_gitname" ]]; then > - cd "$_gitname" && git pull origin > + cd "$_gitname" > + git pull origin > msg "The local files are updated." > cd .. > else > diff --git a/prototypes/PKGBUILD-svn.proto b/prototypes/PKGBUILD-svn.proto > index 27d34fe..2ff37ee 100644 > --- a/prototypes/PKGBUILD-svn.proto > +++ b/prototypes/PKGBUILD-svn.proto > @@ -35,7 +35,8 @@ build() { > msg "Connecting to SVN server...." > > if [[ -d "$_svnmod/.svn" ]]; then > - (cd "$_svnmod" && svn up -r "$pkgver") > + cd "$_svnmod" > + svn up -r "$pkgver" > cd .. > else > svn co "$_svntrunk" --config-dir ./ -r "$pkgver" "$_svnmod" > -- > 1.7.7.1 >
pgplrxp6yU88U.pgp
Description: PGP signature
