Printf > echo

Why aren't you using printf instead of echo?

Attached: 1639460829517.png (363x177, 26.97K)

Other urls found in this thread:

cs.uleth.ca/~holzmann/C/system/shell_commands.html
stackoverflow.com/questions/47517880/store-result-of-shell-command-in-variable-in-c
man7.org/linux/man-pages/man1/env.1.html
twitter.com/SFWRedditVideos

I don't always need formatted output?

Yes you do

Prove it

because I dont script in bash
shell scripting is retarded
write a c program, compile it. chmod +x it. place it in /bin. reuse it over and over again. this is the best method of writing your own system utilities.

yeah but how do you execute and store the output of bash commands in C? If I knew this I'd probably scrap bash scripting.

cs.uleth.ca/~holzmann/C/system/shell_commands.html
stackoverflow.com/questions/47517880/store-result-of-shell-command-in-variable-in-c

you have to do some pipeshit to do that because unix

that seems kinda hacky, with bash it's just built in

ah, pipes... what a goddamn nightmare Systems Programming was.

>write a c program, compile it. chmod +x it
>chmod +x it
What kind of dogshit compiler doesn't make it executable on its own?

No need to answer, I already know you're just larping.

>#!/usr/bin/env bash
pure gayness
doesn't allow you to pass any parameters to bash, like mandatory -e
use:
#!/bin/bash -e

and fuck all the sick distros that do not ship bash in /bin

quintessential Any Forums post - bait, appealing to beginners (majority of users), strongly opinionated, inducing strong emotions, on a topic which is essentially meaningless

Attached: womeninthegym.webm (406x720, 270.21K)

Because about 95% of echos, I just want to print a simple message like "enter the output path" or "success". Most of the remaining 5% are simple variable replacements like "errors occurred in $nerrors items". The small number of times when I need to format a number or string, I use printf. All the other times, it's clunky and echo is simpler

Yes it does
man7.org/linux/man-pages/man1/env.1.html
>Running a script named 1.pl containing the following first line:
> #!/usr/bin/env -S perl -w -T
>Will execute perl -w -T 1.pl .

cat is even better

real men script in powershell.

Why not use all of them?
printf '%s\n' "`echo "Error code 4 occurred"`" | cat

Last time i used gcc (a few weeks ago) it didn't

Because it doesn't printf in your mom's vagina.

>#!/bin/bash
bad because hard-coded bash path
>#!/usr/bin/env bash
good despite hard-coded env path

Attached: retard-1mb.png (546x658, 91.03K)