lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] [lmi-commits] master c40f2f8 14/18: Routinely run shellcheck


From: Vadim Zeitlin
Subject: Re: [lmi] [lmi-commits] master c40f2f8 14/18: Routinely run shellcheck
Date: Thu, 30 May 2019 01:16:53 +0200

On Wed, 29 May 2019 18:49:09 -0400 (EDT) Greg Chicares <address@hidden> wrote:

GC> branch: master
GC> commit c40f2f888e900be8278626c428adea03c7f2d95f
GC> Author: Gregory W. Chicares <address@hidden>
GC> Commit: Gregory W. Chicares <address@hidden>
GC> 
GC>     Routinely run shellcheck
GC>     
GC>     Used 'xargs -P' in 'GNUmakefile' because it roughly quintuples the
GC>     speed of the command in which it occurs.
[...]
GC> +# First line, truncated at its first blank:
GC> +shebang="$(sed -e'1!d' -e's/ .*$//' "$1")"
GC> +case $shebang  in
GC> +    ("#!/bin/sh")
GC> +        shellcheck --external-sources "$1"
GC> +    ;;
GC> +    ("#!/bin/zsh")
GC> +        new_name="/tmp/$(basename "$1")$(date -u +'%s_%N').eraseme"
GC> +        cp -a "$1" "$new_name"
GC> +        sed -i "$new_name" -e'1s/zsh/sh/'
GC> +        shellcheck --external-sources "$new_name"
GC> +        rm "$new_name"

 I'd prefer doing something like

        tail -n +2 "$1" | shellcheck --shell=sh --external-sources -

to avoid dealing with the temporary files.

 Regards,
VZ

Attachment: pgpN4xUcGWhHC.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]