Find the answer to your Linux question:
Results 1 to 4 of 4
Like Tree1Likes
  • 1 Post By Irithori
Is there any way to validate the coverage of the shell scripts ? i have project having lot's of shell scripting, i need to ensure static Analysis can be performed ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2011
    Posts
    12

    code coverage tools for validating the scripts


    Is there any way to validate the coverage of the shell scripts ? i have project having lot's of shell scripting, i need to ensure static Analysis can be performed on the coverage for the shell scripts, is there any tool available ?

  2. #2
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    I'm not sure what you mean by "static Analysis", but if you want to check that the syntax of the shell scripts (and they are bash/sh) are okay, you can use Bash's built-in feature:
    Code:
    bash -n script.sh;echo $?
    If the syntax is okay, a '0' will be printed. If there is something wrong with the syntax, then errors will no doubt be spewed to the terminal, and a non-zero exit status will be printed.

  3. #3
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,398
    anish2good likes this.
    You must always face the curtain with a bow.

  4. #4
    drl
    drl is offline
    Linux Engineer drl's Avatar
    Join Date
    Apr 2006
    Location
    Saint Paul, MN, USA / CentOS, Debian, Slackware, {Free, Open, Net}BSD, Solaris
    Posts
    1,288
    Hi.

    A work in progress:
    https://github.com/feuerbach/loker

    and possibly not quite what you want:
    checkbashisms

    cheers, drl
    Welcome - get the most out of the forum by reading forum basics and guidelines: click here.
    90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
    We look forward to helping you with the challenge of the other 10%.
    ( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •