martanne / vis

A vi-like editor based on Plan 9's structural regular expressions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

vis-clipboard contains bashisms (using "type")

mcepl opened this issue · comments

checkbashisms is not happy with vis-clipboard:

~$ checkbashisms vis-clipboard
possible bashism in vis-clipboard line 17 (type):
			if type "$c" >/dev/null 2>&1; then
possible bashism in vis-clipboard line 26 (type):
			if type "$c" >/dev/null 2>&1; then
possible bashism in vis-clipboard line 37 (type):
	if type pbcopy >/dev/null 2>&1; then
~$

I am not sure how relevant type warning really is (is it more portable than test -x?), but at least it should be considered.

And yes, shellcheck is not happy with this script either:

$ shellcheck vis-clipboard

In vis-clipboard line 11:
	vc_fatal "`basename $0` [--selection sel] [--usable|--copy|--paste]"
                  ^-----------^ SC2006 (style): Use $(...) notation instead of legacy backticks `...`.

Did you mean:
	vc_fatal "$(basename $0) [--selection sel] [--usable|--copy|--paste]"


In vis-clipboard line 59:
	COPY_CMD="`vc_determine_command 2>/dev/null`"
                  ^-- SC2006 (style): Use $(...) notation instead of legacy backticks `...`.

Did you mean:
	COPY_CMD="$(vc_determine_command 2>/dev/null)"


In vis-clipboard line 61:
	if [ $? -ne 0 ] || [ -z "$COPY_CMD" ]; then
             ^-- SC2181 (style): Check exit code directly with e.g. 'if ! mycmd;', not indirectly with $?.


In vis-clipboard line 71:
	PASTE_CMD="`vc_determine_command 2>/dev/null`"
                   ^-- SC2006 (style): Use $(...) notation instead of legacy backticks `...`.

Did you mean:
	PASTE_CMD="$(vc_determine_command 2>/dev/null)"


In vis-clipboard line 73:
	if [ $? -ne 0 ] || [ -z "$PASTE_CMD" ]; then
             ^-- SC2181 (style): Check exit code directly with e.g. 'if ! mycmd;', not indirectly with $?.

For more information:
  https://www.shellcheck.net/wiki/SC2006 -- Use $(...) notation instead of le...
  https://www.shellcheck.net/wiki/SC2181 -- Check exit code directly with e.g...
$