sarroutbi / own

Personal repository for scaffolding stuff

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix issues reported by shellcheck in scripts/ai/instruct-lab-questions/generate-snake-case-sentences-feed.sh

sarroutbi opened this issue · comments

The list of issues reported is:

$ shellcheck generate-snake-case-sentences-feed.sh 

In generate-snake-case-sentences-feed.sh line 40:
cat "${SENTENCES_FILE}" | while read sentence;
    ^-----------------^ SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
                                ^--^ SC2162 (info): read without -r will mangle backslashes.


In generate-snake-case-sentences-feed.sh line 43:
    answer=$(echo ${sentence} | sed -e 's/\(.*\)/\L\1/' | sed -e 's@ @_@g')
                  ^---------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
    answer=$(echo "${sentence}" | sed -e 's/\(.*\)/\L\1/' | sed -e 's@ @_@g')


In generate-snake-case-sentences-feed.sh line 45:
    printf "    question:\n      \"${question}\"\n"
           ^-- SC2059 (info): Don't use variables in the printf format string. Use printf '..%s..' "$foo".