[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] [lmi-commits] master c40f2f8 14/18: Routinely run shellcheck
From: |
Greg Chicares |
Subject: |
Re: [lmi] [lmi-commits] master c40f2f8 14/18: Routinely run shellcheck |
Date: |
Thu, 30 May 2019 14:50:11 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 |
On 2019-05-29 23:16, Vadim Zeitlin wrote:
> On Wed, 29 May 2019 18:49:09 -0400 (EDT) Greg Chicares <address@hidden> wrote:
[...]
> 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.
Thanks. I had tried:
sed -e'0,/^#!/d' "gwc/invert.sh" | shellcheck --shell=sh --external-sources
and incorrectly concluded that shellcheck didn't accept input piped
in through stdin.
Change committed and pushed.
I prefer sed to tail for irrational personal reasons: 'tail -n +2'
looks to me like it would delete two lines.