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

use shellcheck #38

Open
nathanlynch opened this issue Mar 6, 2020 · 0 comments
Open

use shellcheck #38

nathanlynch opened this issue Mar 6, 2020 · 0 comments
Assignees

Comments

@nathanlynch
Copy link
Member

powerpc-utils contains several non-trivial shell scripts which contain basic errors and bad practices:

In ofpathname line 266:
        if [ $? -eq 0 ]; then
             ^-- SC2181: Check exit code directly with e.g. 'if mycmd;', not indirectly with $?.


In ofpathname line 271:
    if [ -f $PWD/devpath ]; then
            ^--^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
    if [ -f "$PWD"/devpath ]; then


In ofpathname line 272:
	echo `$CAT $PWD/devpath`
             ^-----------------^ SC2046: Quote this to prevent word splitting.
             ^-----------------^ SC2005: Useless echo? Instead of 'echo $(cmd)', just use 'cmd'.
             ^-----------------^ SC2006: Use $(...) notation instead of legacy backticked `...`.
                   ^--^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
	echo $($CAT "$PWD"/devpath)


In ofpathname line 298:
    cd $start_dir
    ^-----------^ SC2164: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.
       ^--------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
    cd "$start_dir" || exit

We should use shellcheck, perhaps as part of make check or a commit hook, in order to bring up the quality of the scripts.
https://www.shellcheck.net/

@tyreld tyreld self-assigned this Jun 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants