Improvements suggested by shellcheck #1

Open
opened 2021-04-27 20:34:14 +02:00 by Ghost · 0 comments

Ich hab mal Shellcheck über das Bash Script laufen lassen und dabei gab es folgende Vorschläge zur Verbesserung:

In mail2members.sh line 11In mail2members.sh line 11`:
    echo "\t-h --help"
         ^-----------^ SC2028: echo may not expand escape sequences. Use printf.


In mail2members.sh line 12:
    echo "\t--member-data=member-data.csv"
         ^-- SC2028: echo may not expand escape sequences. Use printf.


In mail2members.sh line 13:
    echo "\t--template=template.erb"
         ^-------------------------^ SC2028: echo may not expand escape sequences. Use printf.


In mail2members.sh line 14:
    echo "\t--subject=subject"
         ^-------------------^ SC2028: echo may not expand escape sequences. Use printf.


In mail2members.sh line 15:
    echo "\t--smtphost=smtphost"
         ^---------------------^ SC2028: echo may not expand escape sequences. Use printf.


In mail2members.sh line 16:
    echo "\t--smtpuser=smtpuser"
         ^---------------------^ SC2028: echo may not expand escape sequences. Use printf.


In mail2members.sh line 17:
    echo "\t--smtppassword=smtppassword"
         ^-----------------------------^ SC2028: echo may not expand escape sequences. Use printf.


In mail2members.sh line 23:
    PARAM=`echo $1 | awk -F= '{print $1}'`
          ^-- SC2006: Use $(...) notation instead of legacy backticked `...`.
                ^-- SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
    PARAM=$(echo "$1" | awk -F= '{print $1}')


In mail2members.sh line 24:
    VALUE=`echo $1 | awk -F= '{print $2}'`
          ^-- SC2006: Use $(...) notation instead of legacy backticked `...`.
                ^-- SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
    VALUE=$(echo "$1" | awk -F= '{print $2}')


In mail2members.sh line 80:
echo "MEMBER_DATA = "$MEMBER_DATA
                     ^----------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
echo "MEMBER_DATA = ""$MEMBER_DATA"


In mail2members.sh line 81:
echo "TEMPLATE = "$TEMPLATE
                  ^-------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
echo "TEMPLATE = ""$TEMPLATE"


In mail2members.sh line 82:
echo "SUBJECT = "$SUBJECT
                 ^------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
echo "SUBJECT = ""$SUBJECT"


In mail2members.sh line 104:
	erb nick="$nick" passwort="$passwort" $TEMPLATE \
                                              ^-------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
	erb nick="$nick" passwort="$passwort" "$TEMPLATE" \


In mail2members.sh line 108:
		   -eas -r ${fingerprint// /} \
                           ^----------------^ SC3060: In POSIX sh, string replacement is undefined.
                           ^----------------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
		   -eas -r "${fingerprint// /}" \


In mail2members.sh line 113:
		    --server $SMTPHOST \
                             ^-------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
		    --server "$SMTPHOST" \


In mail2members.sh line 114:
		    --auth-user $SMTPUSER \
                                ^-------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
		    --auth-user "$SMTPUSER" \


In mail2members.sh line 115:
		    --auth-password $SMTPPASSWORD \
                                    ^-----------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
		    --auth-password "$SMTPPASSWORD" \


In mail2members.sh line 118:
	erb nick="$nick" passwort="$passwort" $TEMPLATE
                                              ^-------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
	erb nick="$nick" passwort="$passwort" "$TEMPLATE"


In mail2members.sh line 119:
	erb nick="$nick" passwort="$passwort" $TEMPLATE \
                                              ^-------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
	erb nick="$nick" passwort="$passwort" "$TEMPLATE" \


In mail2members.sh line 123:
		   -eas -r ${fingerprint// /}
                           ^----------------^ SC3060: In POSIX sh, string replacement is undefined.
                           ^----------------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
		   -eas -r "${fingerprint// /}"


In mail2members.sh line 125:
done < $MEMBER_DATA
       ^----------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
done < "$MEMBER_DATA"

For more information:
  https://www.shellcheck.net/wiki/SC3060 -- In POSIX sh, string replacement i...
  https://www.shellcheck.net/wiki/SC2028 -- echo may not expand escape sequen...
  https://www.shellcheck.net/wiki/SC2086 -- Double quote to prevent globbing ...
Ich hab mal [Shellcheck](https://www.shellcheck.net/) über das Bash Script laufen lassen und dabei gab es folgende Vorschläge zur Verbesserung: ```bash In mail2members.sh line 11In mail2members.sh line 11`: echo "\t-h --help" ^-----------^ SC2028: echo may not expand escape sequences. Use printf. In mail2members.sh line 12: echo "\t--member-data=member-data.csv" ^-- SC2028: echo may not expand escape sequences. Use printf. In mail2members.sh line 13: echo "\t--template=template.erb" ^-------------------------^ SC2028: echo may not expand escape sequences. Use printf. In mail2members.sh line 14: echo "\t--subject=subject" ^-------------------^ SC2028: echo may not expand escape sequences. Use printf. In mail2members.sh line 15: echo "\t--smtphost=smtphost" ^---------------------^ SC2028: echo may not expand escape sequences. Use printf. In mail2members.sh line 16: echo "\t--smtpuser=smtpuser" ^---------------------^ SC2028: echo may not expand escape sequences. Use printf. In mail2members.sh line 17: echo "\t--smtppassword=smtppassword" ^-----------------------------^ SC2028: echo may not expand escape sequences. Use printf. In mail2members.sh line 23: PARAM=`echo $1 | awk -F= '{print $1}'` ^-- SC2006: Use $(...) notation instead of legacy backticked `...`. ^-- SC2086: Double quote to prevent globbing and word splitting. Did you mean: PARAM=$(echo "$1" | awk -F= '{print $1}') In mail2members.sh line 24: VALUE=`echo $1 | awk -F= '{print $2}'` ^-- SC2006: Use $(...) notation instead of legacy backticked `...`. ^-- SC2086: Double quote to prevent globbing and word splitting. Did you mean: VALUE=$(echo "$1" | awk -F= '{print $2}') In mail2members.sh line 80: echo "MEMBER_DATA = "$MEMBER_DATA ^----------^ SC2086: Double quote to prevent globbing and word splitting. Did you mean: echo "MEMBER_DATA = ""$MEMBER_DATA" In mail2members.sh line 81: echo "TEMPLATE = "$TEMPLATE ^-------^ SC2086: Double quote to prevent globbing and word splitting. Did you mean: echo "TEMPLATE = ""$TEMPLATE" In mail2members.sh line 82: echo "SUBJECT = "$SUBJECT ^------^ SC2086: Double quote to prevent globbing and word splitting. Did you mean: echo "SUBJECT = ""$SUBJECT" In mail2members.sh line 104: erb nick="$nick" passwort="$passwort" $TEMPLATE \ ^-------^ SC2086: Double quote to prevent globbing and word splitting. Did you mean: erb nick="$nick" passwort="$passwort" "$TEMPLATE" \ In mail2members.sh line 108: -eas -r ${fingerprint// /} \ ^----------------^ SC3060: In POSIX sh, string replacement is undefined. ^----------------^ SC2086: Double quote to prevent globbing and word splitting. Did you mean: -eas -r "${fingerprint// /}" \ In mail2members.sh line 113: --server $SMTPHOST \ ^-------^ SC2086: Double quote to prevent globbing and word splitting. Did you mean: --server "$SMTPHOST" \ In mail2members.sh line 114: --auth-user $SMTPUSER \ ^-------^ SC2086: Double quote to prevent globbing and word splitting. Did you mean: --auth-user "$SMTPUSER" \ In mail2members.sh line 115: --auth-password $SMTPPASSWORD \ ^-----------^ SC2086: Double quote to prevent globbing and word splitting. Did you mean: --auth-password "$SMTPPASSWORD" \ In mail2members.sh line 118: erb nick="$nick" passwort="$passwort" $TEMPLATE ^-------^ SC2086: Double quote to prevent globbing and word splitting. Did you mean: erb nick="$nick" passwort="$passwort" "$TEMPLATE" In mail2members.sh line 119: erb nick="$nick" passwort="$passwort" $TEMPLATE \ ^-------^ SC2086: Double quote to prevent globbing and word splitting. Did you mean: erb nick="$nick" passwort="$passwort" "$TEMPLATE" \ In mail2members.sh line 123: -eas -r ${fingerprint// /} ^----------------^ SC3060: In POSIX sh, string replacement is undefined. ^----------------^ SC2086: Double quote to prevent globbing and word splitting. Did you mean: -eas -r "${fingerprint// /}" In mail2members.sh line 125: done < $MEMBER_DATA ^----------^ SC2086: Double quote to prevent globbing and word splitting. Did you mean: done < "$MEMBER_DATA" For more information: https://www.shellcheck.net/wiki/SC3060 -- In POSIX sh, string replacement i... https://www.shellcheck.net/wiki/SC2028 -- echo may not expand escape sequen... https://www.shellcheck.net/wiki/SC2086 -- Double quote to prevent globbing ... ```
gulliver self-assigned this 2021-04-27 22:23:31 +02:00
This repo is archived. You cannot comment on issues.
No Milestone
No project
No Assignees
1 Participants
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: gulliver/mail2members#1
No description provided.