DEV Community

[Comment from a deleted post]
Collapse
 
qm3ster profile image
Mihail Malo

Why tho?

Collapse
 
bennypowers profile image
Benny Powers 🇮🇱🇨🇦

proficiency on the shell lets you do things much more quickly. Here's an example using my current fav, fish shell:

for size in 48 96 128 192 512
  convert -resize icon.svg "icon-"$size"x"$size".png"
end

And now you have a set of web-app-manifest icons with minimal effort.

More than that, though, I believe that learning to get comfortable on a CLI/REPL helps you to "think like a programmer"

 
qm3ster profile image
Mihail Malo • Edited
invalid argument for option `-resize': icon.svg @ error/convert.c/ConvertImageCommand/2592.
 
qm3ster profile image
Mihail Malo

What if, instead, one does this:

node -p "[48,96,128,192,512].map(s=>\`convert -resize \${s}x\${s} icon.svg \"icon-\${s}x\${s}.png\"\`).join('\n')" | bash

🤔🤔🤔

 
bennypowers profile image
Benny Powers 🇮🇱🇨🇦

For specific APIs see the imagemagick docs

 
qm3ster profile image
Mihail Malo

Please don't be naughty.
It's a mistake in your example and is already fixed in my second comment.

Collapse
 
zhu48 profile image
Zuodian Hu

With shell scripts and some simple tools, you can do an a mazing amount of build automation.

As an example, in college, my robotics club had entire software applications that you could build and run on with one shell commands. If you had the parent repository, you run the shell script, and the dependencies get cloned the GitHub, all of them get built, the binaries get put in the right places, and the application is ready to run. The software developers could just hand a Git repository to the Mechanical engineers, and the mechanical engineers use a single shell command to be able to run the latest build of the robot control UI. All because a few people knew a little shell scripting.

 
qm3ster profile image
Mihail Malo

Python can do that. Node.js can do that. A binary can do that.
Why learn a shell scripting language? (Especially an old one, with no structured data types)

 
zhu48 profile image
Zuodian Hu

Because you're giving stuff to mechanical engineers, and they don't have a Javascript engine or a Python interpreter installed.

 
qm3ster profile image
Mihail Malo

And I guess they have to have a bash-compatible shell installed, but their architecture isn't definitely x86_64?

 
zhu48 profile image
Zuodian Hu

And you're right, Python or JS can work better than bash for automatic builds. It's kind of like knowing assembly or HTML. If you know a few really basic things, it can be really useful in a few select cases, but most of the time there may be better tools. And if you're like me, you also just get a kick out of playing with low level stuff.