scripts

My personal collection of scripts
git clone git://src.gearsix.net/scriptsscripts.zip
Log | Files | Refs | Atom | README | LICENSE

TODO (raw) (11143B)


   1 
   2 In src/posix/catrm.sh line 6:
   3 for f in $@; do
   4          ^-- SC2068: Double quote array expansions to avoid re-splitting elements.
   5 
   6 
   7 In src/posix/catrm.sh line 9:
   8 		read -p "read remove '$(readlink -f $f)' [y/n/c]? " -n 1 ync
   9                 ^--^ SC2162: read without -r will mangle backslashes.
  10                                                     ^-- SC2086: Double quote to prevent globbing and word splitting.
  11 
  12 Did you mean: 
  13 		read -p "read remove '$(readlink -f "$f")' [y/n/c]? " -n 1 ync
  14 
  15 
  16 In src/posix/catrm.sh line 11:
  17 		if   [ "$ync" == "y" ]; then rm $f
  18                                                 ^-- SC2086: Double quote to prevent globbing and word splitting.
  19 
  20 Did you mean: 
  21 		if   [ "$ync" == "y" ]; then rm "$f"
  22 
  23 
  24 In src/posix/catrm.sh line 12:
  25 		elif [ "$ync" == "c" ]; then cat $f; unset ync
  26                                                  ^-- SC2086: Double quote to prevent globbing and word splitting.
  27 
  28 Did you mean: 
  29 		elif [ "$ync" == "c" ]; then cat "$f"; unset ync
  30 
  31 
  32 In src/posix/compress-pdf.sh line 7:
  33 if [ -z $1 ] || [ -z $2 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
  34         ^-- SC2086: Double quote to prevent globbing and word splitting.
  35                      ^-- SC2086: Double quote to prevent globbing and word splitting.
  36 
  37 Did you mean: 
  38 if [ -z "$1" ] || [ -z "$2" ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
  39 
  40 
  41 In src/posix/compress-pdf.sh line 18:
  42 if [ -e $2 ]; then out="$2"; fi
  43         ^-- SC2086: Double quote to prevent globbing and word splitting.
  44 
  45 Did you mean: 
  46 if [ -e "$2" ]; then out="$2"; fi
  47 
  48 
  49 In src/posix/compress-pdf.sh line 20:
  50 gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=$1 -dNOPAUSE -dQUIET -dBATCH -sOutputFile=$out $in
  51                                                             ^-- SC2086: Double quote to prevent globbing and word splitting.
  52                                                                                                       ^--^ SC2086: Double quote to prevent globbing and word splitting.
  53                                                                                                            ^-^ SC2086: Double quote to prevent globbing and word splitting.
  54 
  55 Did you mean: 
  56 gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS="$1" -dNOPAUSE -dQUIET -dBATCH -sOutputFile="$out" "$in"
  57 
  58 
  59 In src/posix/flac2mp3.sh line 14:
  60 for file in $1/*.flac; do
  61             ^-- SC2231: Quote expansions in this for loop glob to prevent wordsplitting, e.g. "$dir"/*.txt .
  62 
  63 
  64 In src/posix/flac2mp3.sh line 15:
  65   ffmpeg -i "$file" -qscale:a 0 "${file[@]/%flac/mp3}"
  66                                  ^------------------^ SC2039: In POSIX sh, string replacement is undefined.
  67 
  68 
  69 In src/posix/git-clone-bulk.sh line 14:
  70 for repo in $@; do git clone $repo; done
  71             ^-- SC2068: Double quote array expansions to avoid re-splitting elements.
  72                              ^---^ SC2086: Double quote to prevent globbing and word splitting.
  73 
  74 Did you mean: 
  75 for repo in $@; do git clone "$repo"; done
  76 
  77 
  78 In src/posix/git-pull-all.sh line 13:
  79 git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
  80                                       ^--^ SC2162: read without -r will mangle backslashes.
  81 
  82 
  83 In src/posix/gobuild.sh line 19:
  84 for a in ${arch[@]}; do
  85          ^--------^ SC2068: Double quote array expansions to avoid re-splitting elements.
  86 
  87 
  88 In src/posix/gobuild.sh line 20:
  89 	for o in ${os[@]}; do
  90                  ^------^ SC2068: Double quote array expansions to avoid re-splitting elements.
  91 
  92 
  93 In src/posix/gobuild.sh line 28:
  94 		GOARCH=$a GOOS=$o go build -o $name-$a-$o $src
  95                                               ^---^ SC2086: Double quote to prevent globbing and word splitting.
  96                                                     ^-- SC2086: Double quote to prevent globbing and word splitting.
  97                                                        ^-- SC2086: Double quote to prevent globbing and word splitting.
  98                                                           ^--^ SC2086: Double quote to prevent globbing and word splitting.
  99 
 100 Did you mean: 
 101 		GOARCH=$a GOOS=$o go build -o "$name"-"$a"-"$o" "$src"
 102 
 103 
 104 In src/posix/grepf.sh line 14:
 105 grep -rnw $1 -e "$2"
 106           ^-- SC2086: Double quote to prevent globbing and word splitting.
 107 
 108 Did you mean: 
 109 grep -rnw "$1" -e "$2"
 110 
 111 
 112 In src/posix/mkdcp.sh line 15:
 113 mkdir -p $dir
 114          ^--^ SC2086: Double quote to prevent globbing and word splitting.
 115 
 116 Did you mean: 
 117 mkdir -p "$dir"
 118 
 119 
 120 In src/posix/mkdcp.sh line 19:
 121 for file in $@; do
 122             ^-- SC2068: Double quote array expansions to avoid re-splitting elements.
 123 
 124 
 125 In src/posix/mkdcp.sh line 20:
 126     cp -r $file $dir;
 127           ^---^ SC2086: Double quote to prevent globbing and word splitting.
 128                 ^--^ SC2086: Double quote to prevent globbing and word splitting.
 129 
 130 Did you mean: 
 131     cp -r "$file" "$dir";
 132 
 133 
 134 In src/posix/mkded.sh line 13:
 135 mkdir -p $1;
 136          ^-- SC2086: Double quote to prevent globbing and word splitting.
 137 
 138 Did you mean: 
 139 mkdir -p "$1";
 140 
 141 
 142 In src/posix/mkded.sh line 14:
 143 cd $1;
 144 ^---^ SC2164: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.
 145    ^-- SC2086: Double quote to prevent globbing and word splitting.
 146 
 147 Did you mean: 
 148 cd "$1" || exit;
 149 
 150 
 151 In src/posix/mkded.sh line 15:
 152 if [ $2 ]; then touch $2; fi
 153      ^-- SC2086: Double quote to prevent globbing and word splitting.
 154                       ^-- SC2086: Double quote to prevent globbing and word splitting.
 155 
 156 Did you mean: 
 157 if [ "$2" ]; then touch "$2"; fi
 158 
 159 
 160 In src/posix/mkded.sh line 16:
 161 $EDITOR $2;
 162         ^-- SC2086: Double quote to prevent globbing and word splitting.
 163 
 164 Did you mean: 
 165 $EDITOR "$2";
 166 
 167 
 168 In src/posix/mkdmv.sh line 19:
 169 for file in $@; do
 170             ^-- SC2068: Double quote array expansions to avoid re-splitting elements.
 171 
 172 
 173 In src/posix/mkdtouch.sh line 12:
 174 mkdir $1
 175       ^-- SC2086: Double quote to prevent globbing and word splitting.
 176 
 177 Did you mean: 
 178 mkdir "$1"
 179 
 180 
 181 In src/posix/mkdtouch.sh line 14:
 182 touch $@
 183       ^-- SC2068: Double quote array expansions to avoid re-splitting elements.
 184 
 185 
 186 In src/posix/openurl.sh line 6:
 187 for f in $@; do
 188          ^-- SC2068: Double quote array expansions to avoid re-splitting elements.
 189 
 190 
 191 In src/posix/openurl.sh line 7:
 192 	for url in "$(grep -o -E 'https?://[^"]+' $f)"; do
 193                    ^-- SC2066: Since you double quoted this, it will not word split, and the loop will only run once.
 194                                                   ^-- SC2086: Double quote to prevent globbing and word splitting.
 195 
 196 Did you mean: 
 197 	for url in "$(grep -o -E 'https?://[^"]+' "$f")"; do
 198 
 199 
 200 In src/posix/pomodoro.sh line 22:
 201 while [ true ]; do
 202         ^--^ SC2160: Instead of '[ true ]', just use 'true'.
 203 
 204 
 205 In src/posix/pomodoro.sh line 24:
 206     sleep "$WORK" && notify-send -a $NAME "Take a break" $msg
 207                                                          ^--^ SC2086: Double quote to prevent globbing and word splitting.
 208 
 209 Did you mean: 
 210     sleep "$WORK" && notify-send -a $NAME "Take a break" "$msg"
 211 
 212 
 213 In src/posix/pomodoro.sh line 28:
 214     sleep "$BREAK" && notify-send -a $NAME "Back to work" $msg
 215                                                           ^--^ SC2086: Double quote to prevent globbing and word splitting.
 216 
 217 Did you mean: 
 218     sleep "$BREAK" && notify-send -a $NAME "Back to work" "$msg"
 219 
 220 
 221 In src/posix/preview-md.sh line 21:
 222 if [ -e "$out" ]; then rm -i $out; fi
 223                              ^--^ SC2086: Double quote to prevent globbing and word splitting.
 224 
 225 Did you mean: 
 226 if [ -e "$out" ]; then rm -i "$out"; fi
 227 
 228 
 229 In src/posix/preview-md.sh line 23:
 230 if [ $? -eq 0 ]; then
 231      ^-- SC2181: Check exit code directly with e.g. 'if mycmd;', not indirectly with $?.
 232 
 233 
 234 In src/posix/preview-md.sh line 25:
 235 	if [ ! -z $2 ] && [ "$2" = "--open" ] || [ "$2" = "-o" ]; then
 236              ^-- SC2236: Use -n instead of ! -z.
 237                   ^-- SC2086: Double quote to prevent globbing and word splitting.
 238 
 239 Did you mean: 
 240 	if [ ! -z "$2" ] && [ "$2" = "--open" ] || [ "$2" = "-o" ]; then
 241 
 242 
 243 In src/posix/preview-md.sh line 26:
 244 		xdg-open "$out" &>/dev/null
 245                                 ^---------^ SC2039: In POSIX sh, &> is undefined.
 246 
 247 
 248 In src/posix/pyserve.py line 5:
 249 if [ $1 ]; then dir=$1; fi
 250      ^-- SC2086: Double quote to prevent globbing and word splitting.
 251 
 252 Did you mean: 
 253 if [ "$1" ]; then dir=$1; fi
 254 
 255 
 256 In src/posix/pyserve.py line 7:
 257 python3 -m http.server --directory $dir
 258                                    ^--^ SC2086: Double quote to prevent globbing and word splitting.
 259 
 260 Did you mean: 
 261 python3 -m http.server --directory "$dir"
 262 
 263 
 264 In src/posix/pyserve.sh line 5:
 265 if [ $1 ]; then dir=$1; fi
 266      ^-- SC2086: Double quote to prevent globbing and word splitting.
 267 
 268 Did you mean: 
 269 if [ "$1" ]; then dir=$1; fi
 270 
 271 
 272 In src/posix/pyserve.sh line 7:
 273 python3 -m http.server --directory $dir
 274                                    ^--^ SC2086: Double quote to prevent globbing and word splitting.
 275 
 276 Did you mean: 
 277 python3 -m http.server --directory "$dir"
 278 
 279 
 280 In src/posix/randstr.sh line 14:
 281 if [ $1 ]; then len=$1; fi
 282      ^-- SC2086: Double quote to prevent globbing and word splitting.
 283 
 284 Did you mean: 
 285 if [ "$1" ]; then len=$1; fi
 286 
 287 
 288 In src/posix/randstr.sh line 16:
 289 echo $(cat /dev/urandom | tr -dc "a-zA-Z0-9" | fold -w $len | head -n 1)
 290      ^-- SC2046: Quote this to prevent word splitting.
 291      ^-- SC2005: Useless echo? Instead of 'echo $(cmd)', just use 'cmd'.
 292            ^----------^ SC2002: Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
 293                                                        ^--^ SC2086: Double quote to prevent globbing and word splitting.
 294 
 295 Did you mean: 
 296 echo $(cat /dev/urandom | tr -dc "a-zA-Z0-9" | fold -w "$len" | head -n 1)
 297 
 298 
 299 In src/posix/shush.sh line 13:
 300 for bin in $@; do
 301            ^-- SC2068: Double quote array expansions to avoid re-splitting elements.
 302 
 303 
 304 In src/posix/shush.sh line 14:
 305     $bin &>/dev/null
 306          ^---------^ SC2039: In POSIX sh, &> is undefined.
 307 
 308 
 309 In src/posix/strindex.sh line 19:
 310 if [[ "$1" = "-r" ]]; then # swap arguments (e.g. strindex "cat on mat" "mat")
 311    ^---------------^ SC2039: In POSIX sh, [[ ]] is undefined.
 312 
 313 
 314 In src/posix/strindex.sh line 22:
 315     [[ "$x" = "$1" ]] && echo "-1" || echo "${#x}"
 316     ^---------------^ SC2039: In POSIX sh, [[ ]] is undefined.
 317 
 318 
 319 In src/posix/strindex.sh line 25:
 320     [[ "$x" = "$2" ]] && echo "-1"  || echo "${#x}"
 321     ^---------------^ SC2039: In POSIX sh, [[ ]] is undefined.
 322 
 323 
 324 In src/posix/while-true.sh line 16:
 325 while [ true ]; do
 326         ^--^ SC2160: Instead of '[ true ]', just use 'true'.
 327 
 328 
 329 In src/posix/while-true.sh line 20:
 330 	if [ $2 ]; then
 331              ^-- SC2086: Double quote to prevent globbing and word splitting.
 332 
 333 Did you mean: 
 334 	if [ "$2" ]; then
 335 
 336 
 337 In src/posix/while-true.sh line 21:
 338 		sleep $2
 339                       ^-- SC2086: Double quote to prevent globbing and word splitting.
 340 
 341 Did you mean: 
 342 		sleep "$2"
 343 
 344 For more information:
 345   https://www.shellcheck.net/wiki/SC2066 -- Since you double quoted this, it ...
 346   https://www.shellcheck.net/wiki/SC2068 -- Double quote array expansions to ...
 347   https://www.shellcheck.net/wiki/SC2039 -- In POSIX sh, &> is undefined.