Hearted Youtube comments on Fireship (@Fireship) channel.
-
659
-
654
-
653
-
653
-
652
-
652
-
649
-
645
-
641
-
632
-
629
-
627
-
624
-
621
-
620
-
618
-
614
-
614
-
611
-
609
-
604
-
601
-
601
-
601
-
593
-
591
-
589
-
587
-
583
-
582
-
582
-
580
-
579
-
572
-
572
-
569
-
566
-
562
-
562
-
557
-
556
-
552
-
551
-
551
-
546
-
542
-
Some thoughts:
EDIT: Please stop telling me about `#!/bin/sh`. This video is specifically about bash and so is this comment. I am aware that posix sh... exists. If you want to write POSIX compliant scripts, use sh. If you want to write modern scripts, use BASH. Also: even if you use sh instead of bash, you may still be writing bash. The best way to test for that would be shellcheck.
Oh and `/bin/sh` is not specified ny posix either, so you'll probably still want to use `#!/usr/bin/env sh`.
- Please do not use `#!/bin/bash` or `#!/usr/bin/bash` as your shebeng. Instead use `#!/usr/bin/env bash`. This way, bash can be installed pretty much anywhere and it will still work.
- Please always put double qoutes around variables unless you specifically need them unqouted (which you do when loop over an array using a for-loop for example). This will prevent unintended splitting of strings. Note that in bash single qoutes ('), double qoutes (") and backticks (`) all have a different meaning. Speaking of backticks:
- Whenever you see a stackoverflow answer around processing a command's output, you will probably see someone using a command enclosed by backticks. This is deprecated and should not be used. Instead, you can use $(command). However, you should also double qoute that, so "$(command)".
- Variables don't have to be all-caps. However, if you use them like " $VARsomething" where only VAR is the variable name, you may need to use curly brackets to signal bash where the variable starts and ends: "${VAR}something". Those can also be used for substitutions, which I recommend you just look up ;).
532
-
525
-
524
-
520