zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: Zsh option for checking if a file is a shell script
Date: Thu, 12 Aug 2010 09:12:09 -0700	[thread overview]
Message-ID: <100812091209.ZM20191@torch.brasslantern.com> (raw)
In-Reply-To: <AANLkTinuOXQNHbiPcriXRcHfs_c3rX=QCF2kwZu9DOtq@mail.gmail.com>

On Aug 12, 12:23pm, Guillaume Brunerie wrote:
}
} Is there some option (for example --check-syntax) such that
} $ zsh --check-syntax /path/to/a/shell/script
} doesn't do anything except that the return code would be 0
} if /path/to/a/shell/script is indeed a shell script, and non zero otherwise?

$ zsh -n /path/to/some/file

or equivalently but more obviously

$ zsh -o no_exec /path/to/some/file

will parse but not execute the file, and exit with failure if there is
a parse error.  However, just because a file doesn't cause a parse error
is not a guarantee that it is a shell script, and parsing a very big
file is potentially expensive.


  reply	other threads:[~2010-08-12 16:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-12 10:23 Guillaume Brunerie
2010-08-12 16:12 ` Bart Schaefer [this message]
2010-08-16 20:52   ` Guillaume Brunerie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=100812091209.ZM20191@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).