You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on Ubuntu 16.04.3 and I've installed the shellcheck with the command apt install shellcheck.
Now I have such a bash script named test.sh:
#!/bin/bash
ssssss
aaaaaa
Obviously there are two errors as ssssss and aaaaaaa are illegal commands. However, when I execute shellcheck test.sh, I get nothing as output. It doesn't seem that the command shellcheck work as expected on my system.
The text was updated successfully, but these errors were encountered:
They may not be illegal commands, the user could have a ssssss and / or aaaaaa executable on their system. Shellcheck should not assume what users do or do not call their commands and I do not think this is a bug.
I would love if ShellCheck was able to correctly determine which commands will not be found when the script runs, but unfortunately this can't be done. It's equivalent to trying to predict which filenames will or won't exist on the system at the time when you run the script. Whitelisting and searching PATH would be possible options, but they're fragile and problematic in their own ways.
If you just want to test your script on something that will produce useful warnings to try it out, you can e.g. use shellcheck.net's example:
#!/bin/sh
## Example of a broken script.
for f in $(ls *.m3u)
do
grep -qi hq.*mp3 $f \
&& echo -e 'Playlist $f contains a HQ file in mp3 format'
done
I'm working on Ubuntu 16.04.3 and I've installed the shellcheck with the command
apt install shellcheck
.Now I have such a bash script named
test.sh
:Obviously there are two errors as
ssssss
andaaaaaaa
are illegal commands. However, when I executeshellcheck test.sh
, I get nothing as output. It doesn't seem that the commandshellcheck
work as expected on my system.The text was updated successfully, but these errors were encountered: