Questions tagged [shellcheck]

Shellcheck refers to the ShellCheck program.

ShellCheck is a tool for linting shell scripts. It works in the browser or can be installed locally.

References

60 questions
0
votes
0 answers

POSIX SHELL: Assigning expansion of glob to a variable

Been searching for solutions to this problem, but haven't found any good ones. Just about every answer assumes Bash and uses arrays, which is not what I want. So, I have this path, which may have slight variations to it, which I'd like to assign to…
hodahle
  • 21
  • 3
0
votes
0 answers

BASH: shellcheck warning SC2178 for declare -n

New to shellcheck here. See pseudocode and error below. #!/bin/bash function throwAwayFunc() { local _array=(); } function arraysFromArray() { local i _id; _id=$1; declare -n _array="${_id}"; # ***^-- SC2178 (warning):…
BenG
  • 31
  • 5
0
votes
0 answers

AppleScript debug with shellcheck

I am a complete novice using Script Editor. I don't even know what language this is written in, but I'm trying to use shellcheck.net to debug this: var=value LDMIcon to path to resource "LDM_Icon.icns" in bundle (path to me) set CurrentOS to do…
0
votes
1 answer

Actionlint issue with Github actions

I'm trying to use reviewdog/action-actionlint:v1.18.2 and I'm getting this error: shellcheck reported issue in this script: SC2046:warning:1:35: Quote this to prevent word splitting [shellcheck] at this line: run: | echo…
0
votes
0 answers

assign the result of find to a array

I am wondering if there is a better way in bash when passing an array of values to a program like zip since shell check complains like shown in the example. First call shows a way which works but shell check complains, second zip does not work but…
0
votes
1 answer

shellcheck vscode "shellcheck.ignorePatterns" for all files with no extension

I am using the shellcheck vscode extension and I would like shellcheck to ignore files everywhere that do not have a file extension. I have tried many different glob patterns and nothing works. The closest I got was: "shellcheck.ignorePatterns":…
apena
  • 2,091
  • 12
  • 19
0
votes
3 answers

Executing the output as filename

In one of my Bash scripts, there's a point where I have a variable SCRIPT which contains the /path/to/an/exe, and what the script ultimately needs to do, is executing that executable. Therefore the last line of the script is $($SCRIPT) so that…
Enlico
  • 23,259
  • 6
  • 48
  • 102
0
votes
1 answer

Enable again Shellcheck in PhpStorm

After an update of PhpStorm (MacOS) to the new release and some troubles which led me to remove all PhpStorm app instances and reinstall the latest release and then copying the plugins back to the app folder in "~/Library/Application Support" I was…
FullStack Alex
  • 1,783
  • 19
  • 31
0
votes
1 answer

In POSIX sh, string replacement is undefined. while trying to do PASS2="${PASS//[${special_chars}]/}"

My Code is special_chars='[=!=][=@=][=#=][=$=][=%=][=&=]' PASS="e@0cc3auZeeSio&G" PASS2="${PASS//[${special_chars}]/}" I want PASS2 to have all the characters in PASS - special characters. This works fine, but there is shell check error on…
0
votes
1 answer

Bash Mapfile or Read while grep-ing contents of a file

Just looking for any other, perhaps better ways to do the following. Shell check is calling "SC2002 Useless cat" and every other way I have tried to mitigate has failed. It is working as desired, so I am inclined to just leave it alone - unless…
0
votes
3 answers

How to list all files in a directory without absolute paths along with their file sizes, while using find

GNU bash, version 4.4.0 Ubuntu 16.04 I am wanting to list all the files from a directory and print them to column two while printing the size of the files in column one. example 1024 test.jpg 1024 test.js 1024 test.css 1024 test.html I have…
Vituvo
  • 1,008
  • 1
  • 9
  • 29
0
votes
0 answers

How to create cURL Requests with PHP

So I found this code: data=$(curl \ --silent \ --user-agent "ShellCheck@github.com/lollek/scripts-and-stuff" \ --data-urlencode "script@$file" \ "http://www.shellcheck.net/shellcheck.php") Here is full…
Mateusz
  • 323
  • 2
  • 11
  • 23
-1
votes
1 answer

Tweaking syntax checker shellcheck's highlight colors (with syntastic and pathogen)

To me, shellcheck's highlight colors and message zone (where syntax is flagged as dubious and warnings are displayed) are both wrong. Is it possible to modify status-line and main window highlight colors used by shellcheck? I looked into that and…
Cbhihe
  • 511
  • 9
  • 24
-1
votes
3 answers

Compare Decimals in Bash while Loop

In the below code, ShellCheck throws an error in the while clause. count=10.0 while [ $count -le 20.0 ] do echo "Hello" count=$(bc<<< "scale=4; (count+0.1)") done ShellCheck says: Decimals not supported, either use integers or bc I am not…
anishjp
  • 115
  • 3
  • 13
-2
votes
1 answer

How can I avoid sed error on bash script?

I need to add text after the last line, but I'm getting this error. How can I avoid this error keeping the same actions? sed -i -e '$a\ containers:' -e '$a\ - name: container' -e '$a\ image: httpd' -e '$a\ ports:' -e '$a\ - containerPort:…
Kaleby Cadorin
  • 179
  • 2
  • 13
1 2 3
4