shellcheck icon indicating copy to clipboard operation
shellcheck copied to clipboard

Doesn't recognize BASH_ARGV0

Open sergio-costas opened this issue 3 years ago • 0 comments

I'm assigning in a bash script the variable BASH_ARGV0, which is the way of modifying the value of $0. Unfortunately, checkshell doesn't recognize it and shows an SC2034 UNUSED VARIABLE. Tested online and with version 0.8.0.

Example code:

#!/bin/bash

# emulate "exec $@" with "source"
BASH_ARGV0=$1
shift
# shellcheck source=/dev/null
source "$0"
  • [X] The rule's wiki page does not already cover this (e.g. https://shellcheck.net/wiki/SC2086)
  • [X] I tried on https://www.shellcheck.net/ and verified that this is still a problem on the latest commit

sergio-costas avatar Aug 11 '22 17:08 sergio-costas