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 Warnings #6

Open
laywill opened this issue Jan 17, 2021 · 0 comments
Open

Shellcheck reports Warnings #6

laywill opened this issue Jan 17, 2021 · 0 comments

Comments

@laywill
Copy link

laywill commented Jan 17, 2021

Hi,

Really helpful work that has made this process a lot easier! Thanks!

In the spirit of giving back I wanted to take the time to see if I could help improve things to minimise any potential issues for others using the script. Running Shellcheck on dump_vbios.sh produces a number of warnings as of commit 963677c . The output from Shellcheck is listed below.

$ shellcheck dump_vbios.sh
 
Line 35:
gpuid=$(echo "$gpuid" | sed 's/ *$//')
        ^-- SC2001: See if you can use ${variable//search/replace} instead.
 
Line 37:
gpuid=$(echo "$gpuid" | sed 's/^ *//g')
        ^-- SC2001: See if you can use ${variable//search/replace} instead.
 
Line 41:
mygpu=$(lspci -s $gpuid)
                 ^-- SC2086: Double quote to prevent globbing and word splitting.

Did you mean: (apply this, apply all SC2086)
mygpu=$(lspci -s "$gpuid")
 
Line 43:
disconnectid=$(echo "$dumpid" | sed 's?:?\\:?g')
               ^-- SC2001: See if you can use ${variable//search/replace} instead.
 
Line 45:
disconnectid2=$(echo "$disconnectid" | sed 's/\(.*\)0/\11/')
^-- SC2034: disconnectid2 appears unused. Verify use (or export if used externally).
                ^-- SC2001: See if you can use ${variable//search/replace} instead.
 
Line 55:
        mygpu=$(lspci -s $gpuid) || { notvalidpci; exit; }
                         ^-- SC2086: Double quote to prevent globbing and word splitting.

Did you mean: (apply this, apply all SC2086)
        mygpu=$(lspci -s "$gpuid") || { notvalidpci; exit; }
 
Line 196:
                        echo "Vbios folder created at "$mountlocation" "
                                                       ^-- SC2027: The surrounding quotes actually unquote this. Remove or escape them.
                                                       ^-- SC2154: mountlocation is referenced but not assigned.
                                                       ^-- SC2086: Double quote to prevent globbing and word splitting.

Did you mean: (apply this, apply all SC2086)
                        echo "Vbios folder created at ""$mountlocation"" "
 
Line 200:
                        echo "Vbios folder "$mountlocation" already exists"
                                            ^-- SC2027: The surrounding quotes actually unquote this. Remove or escape them.
                                            ^-- SC2086: Double quote to prevent globbing and word splitting.

Did you mean: (apply this, apply all SC2086)
                        echo "Vbios folder ""$mountlocation"" already exists"
 
Line 249:
                        echo "1" | tee -a /sys/bus/pci/devices/$disconnectid/remove
>>                                                             ^-- SC2086: Double quote to prevent globbing and word splitting.

Did you mean: (apply this, apply all SC2086)
                        echo "1" | tee -a /sys/bus/pci/devices/"$disconnectid"/remove
 
Line 268:
                        echo "forcereset is set as "$forcereset" this is not a recognised option"
                                                    ^-- SC2027: The surrounding quotes actually unquote this. Remove or escape them.
 
Line 297:
        cd /sys/bus/pci/devices/"$dumpid"/
        ^-- SC2164: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

Did you mean: (apply this, apply all SC2164)
        cd /sys/bus/pci/devices/"$dumpid"/ || exit
 
Line 300:
        echo "Okay dumping vbios file named "$vbiosname" to the location "$vbioslocation" "
                                             ^-- SC2027: The surrounding quotes actually unquote this. Remove or escape them.
                                             ^-- SC2086: Double quote to prevent globbing and word splitting.
>>                                                                        ^-- SC2027: The surrounding quotes actually unquote this. Remove or escape them.

Did you mean: (apply this, apply all SC2086)
        echo "Okay dumping vbios file named ""$vbiosname"" to the location "$vbioslocation" "

$
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

No branches or pull requests

1 participant