Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shellcheck reports multiple warnings for spot.sh #23

Closed
nodiscc opened this issue Oct 31, 2014 · 0 comments · Fixed by #25
Closed

shellcheck reports multiple warnings for spot.sh #23

nodiscc opened this issue Oct 31, 2014 · 0 comments · Fixed by #25

Comments

@nodiscc
Copy link

nodiscc commented Oct 31, 2014

Hi, thanks for writing this! I'm trying to package the script for Debian and was advised to run shellcheck (http://hackage.haskell.org/package/ShellCheck) on the script before going further. It reports some thngs that you might want to fix.

In spot.sh line 31:
cyan=`echo -e '\033[96m'`
     ^-- SC2006: Use $(..) instead of deprecated `..`


In spot.sh line 32:
reset=`echo -e '\033[39m'`
      ^-- SC2006: Use $(..) instead of deprecated `..`


In spot.sh line 115:
    dir=`echo $1 | sed "s/\/$//"`
        ^-- SC2006: Use $(..) instead of deprecated `..`
         ^-- SC2001: See if you can use ${variable//search/replace} instead.
              ^-- SC2086: Double quote to prevent globbing and word splitting.


In spot.sh line 155:
if [ $filename ]; then
     ^-- SC2086: Double quote to prevent globbing and word splitting.


In spot.sh line 160:
eval "find "$dir" $findopt -type f $exclude -print0" \
            ^-- SC2027: The surrounding quotes actually unquote this. Remove or escape them.
            ^-- SC2086: Double quote to prevent globbing and word splitting.


In spot.sh line 161:
  | GREP_COLOR="1;33;40" xargs -0 grep $grepopt -e "`echo $@`" \
                                       ^-- SC2086: Double quote to prevent globbing and word splitting.
                                                    ^-- SC2116: Useless echo? Instead of 'cmd $(echo foo)', just use 'cmd foo'.
                                                    ^-- SC2006: Use $(..) instead of deprecated `..`
                                                          ^-- SC2068: Double quote array expansions, otherwise they're like $* and break on spaces.


In spot.sh line 165:
  | awk -v linenums=$linenums -v reset=`tput sgr0` -v colors=$colors -v mline=$mline '{
                                       ^-- SC2046: Quote this to prevent word splitting.
                                       ^-- SC2006: Use $(..) instead of deprecated `..`

As you can see it's rather minor things, but there are some quoting warnings that might cause problems in the future. I'll submit a pull request when I get some time, hope you can begin fixing this in the meantime! By the way, the request for packaging is at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=688866 and any help is welcome.

Thanks again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant