3 ms·
Have you not used Python or Perl much? Because both are full of footguns. And I don't see any advantage to for loops in a HLL. These are identical: for i in
by throwawaaarrgh 3y ago
Have you not used Python or Perl much? Because both are full of footguns. And I don't see any advantage to for loops in a HLL. These are identical:
for i in `seq 1 10` ; do
echo i $i
done
for i in range(1,10):
print("i %i\n")
You might find problems with the shell code, and I'll find problems with the Python. But both will print 1 to 10.
- optionalsquid 3y agoPersonally I've found Python to have significantly fewer foot-guns than bash. The biggest reason why I don't use it all of the time is that calling / piping commands takes a lot more typing, so it's easier to use bash for very simple shell scripts. And while there are libraries that simplify shell scripting, that adds external dependencies to your scripts. > for i in range(1,10): > print("i %i\n") This outputs "i %i\n\n" 9 times.
- throwawaaarrgh 3y ago> This outputs "i %i\n\n" 9 times. damn, ya got me there. to be fair, I was drunk when I wrote that xD
- IshKebab 3y agoCome on, they aren't full of footguns in basic things like string comparison or variable assignment. Most of the things on this list couldn't happen in Python: https://mywiki.wooledge.org/BashPitfalls https://mywiki.wooledge.org/BashPitfalls