>Write a bash script
>It takes 15 seconds to execute
>Rewrite it in javascript
>The execution time is down to 1 second
Why are we still using bash, remind me?
It's All Fucked Shirt $22.14 |
DMT Has Friends For Me Shirt $21.68 |
It's All Fucked Shirt $22.14 |
Post the script so we can laugh at you.
Ok
Bash script:
#!/bin/sh
hashes=$((qbt torrent list -F json | grep -i "hash" | awk '{print $2}' | sed 's/[",]//g'))
total=0
for i in ${hashes[@]}
do
otal=$(($(qbt torrent properties $i -F json | grep -i uploaded" | awk '{print $2}' | sed 's/,//') + $total))
done
echo $(($total / 1073741824))
With javascript:
#!/bin/sh
qbt torrent list -F json > qbt-buffer.json
echo "const fs = require("fs");
const rawData = fs.readFileSync("qbt-buffer.json");
const parsedData = Array.from(JSON.parse(rawData));
const devider = 1024 * 1024 * 1024;
let totalUploaded = 0;
let totalDownloaded = 0;
parsedData.forEach(data => { totalUploaded += data.uploaded;
totalDownloaded += data.downloaded;
});
console.log(`Downloaded: ${Math.round(totalDownloaded / devider)}GB nUploaded: ${Math.round(totalUploaded / devider)}GB`);" > torrents.js
node torrents.js
rm qbt-buffer.json torrents.js
>Array.from(JSON.parse(rawData))
Good morning, sir!
yeah this sort of thing si really not what i would use bash for, text processing, actually using bash arrays, it's just not good
you can do all of what you wrote just in awk alone btw
lmao
works on my machine
lol
Why are you calling qbt in a loop in bash but not in js?
Looks like I was full of shit. I rewrote it without repeated qbt calls and it takes 2 seconds to execute now.
Although js would probably execute faster too if I wasn't too lazy to learn how to execute commands from node directly instead of using a moronic bash wrapper.
sh = require('shelljs')
That's some hilarious shit, thanks for sharing.
BAHAHAHAHHAHAHAHA
Good one anon. Are You the same gay who got really angry over bash sometime ago?
You created an entire thread with "post the worst programing languages, i'll start" and complained that your shitty script with arrays doesn't work.
And in the end Perl won
>perl
makes too much sense to have a role in the current meta
what?
You know, shit like parallel and xargs exist right?
Also, all of that can be done in awk not bash
Just write in python, lua, or golang like a normal scripter
>golang
>script
Dumbfrick, that should be Perl
no one uses perl anymore, dunno why you can't comprehend that, you must be unemployed
tbh if youre a sysadmin and you are writing scripts in perl instead of python most places wont give a shit. its still very popular among boomers
zoom zoom
look at these homosexuals still using perl, fricking dumb zoomer troonys KEK. perl sucks wiener, never seen it in the wild. gayS
>echoing the program to a file in bash and running node on it, then removing it
my fricking sides
OP as always a homosexual
>you are not allowed to be new to scripting
OP needed to read the sticky before he made another thinly veiled tech support thread
Being new to scripting is fine. Fricking up and blaming an entire shell is another thing entirely.
you literally blamed bash for you being a moron
I'm sure this would take 2 or 3 lines of perl, but I want to see an example output of
qbt torrent list -F json
and
qbt torrent properties $i -F json
The only thing good about perl, is it's regex engine
5ms startup time
practical cli flags
easy syntax which doesn't require parentheses
functions taking a list and returning a list
grep (filter), map
closures
both lexical and dynamic scoping
>its regex engine
not only the engine itself but how it interfaces seamlessly with the language, with a syntax for it, special operators and match variables set each time a match attempt is made
But sure sweety, whatever to help you sleep better
Well you are using javascript's data sructure in the bash script, try coding a javascript script with unix csv files.
The right tool for the right job or something.
Also bash runs in like 10kb in machines as old as 1991. To run js you need to get pozzed by downloading at least a couple of Gs
lmfao your shitty script doesn't even work
there's no way this is real, this is too moronic to be believed. i can tell whoever wrote this is indian.
>echo to file outside of /tmp
>execute file
>remove file
Good day Sir
learn to use /tmp you fricking curryeater
how's the weather in rampajesh, delhi good sir have you done the needful benchod
there's so much wrong in your bash script I don't know where to begin
>json to grep to awk to sed for json parsing
>one uses an external program another doesnt
anon i...
$ time perl -MJSON="from_json" -E 'my ($u, $d); map { $d += $_->{downloaded}; $u += $_->{uploaded}; } @{ from_json qx/qbt torrent list -F json/}; say "Downloaded : $dnUploaded : $u";'
Downloaded : 104381889869
Uploaded : 2402172754
perl -MJSON="from_json" -E 0,61s user 0,02s system 96% cpu 0,646 total
Ok I forgot to divide the up/download values by 1024^3, but it doesn't matter in the end
$ time perl -MJSON="from_json" -E 'my ($u, $d); map { $d += $_->{downloaded} / 1024**3; $u += $_->{uploaded} / 1024**3; } @{ from_json qx/qbt torrent list -F json/}; say "Downloaded : $d GBnUploaded : $u GB";'
Downloaded : 97.2132104160264 GB
Uploaded : 2.23719771392643 GB
perl -MJSON="from_json" -E 0,60s user 0,02s system 96% cpu 0,638 total
JSON::XS anon, JSON::XS
Jesus christ
that's some horrendous JavaScript holy shit
Untested:
const data = require("./qbt-buffer.json");
const sum = {
downloaded: data.reduce((a, b) => a.downloaded + b.downloaded, 0),
uploaded: data.reduce((a, b) => a.uploaded + b.uploaded, 0),
};
console.table(sum);
>grep awk sed in the same line
>create and remove de same file
is this the power of javascript shills?
you fricking suck and should stop using computers entirely.
use jq
Good Looking, Perfect for gorgeous looks, can push asap
>fpbp
>no response from op
I don't sit here refreshing the page 20 times per second, Black person.
>refreshing the page 20 times per second
turn on auto update moron
idk
i use perl and it just werks
bash is useful for piping programs together and otherwise executing stuff in order
doing that with node/python/etc involves writing lots of exec() calls where you just write the bash into the script
so the benefits of the language dont really offer much at all in this case
that's why we have bash
Why does it even have to be fast? It's a shell, not a programming language.
If you want the system do do baka for you, on a system level, use a shell.
If you want to process data, use interpreted langs.
stop writing shitty scripts and blaming bash?
bruh put a & at the end so it gets done all at once
#!/bin/sh
hashes=$((qbt torrent list -F json | grep -i "hash" | awk '{print $2}' | sed 's/[",]//g'))
total=0
for i in ${hashes[@]}
do
otal=$(($(qbt torrent properties $i -F json | grep -i uploaded" | awk '{print $2}' | sed 's/,//') + $total)) &
done
wait
echo $(($total / 1073741824))
then put a 'wait' just before the final echo
also you used 'otal' instead of 'total' in the loop but i didn't fix it.
I didn't it's an epic copypaste failure.
personally i love bash its really easy
>greps cat output out of convenience
Guilty as frick
>grep cat output in a loop and use carriage returns so as not to not clutter the terminal
Also guilty
One thing that I enjoy about BASH and UNIX scripting are pipes. Pipes are amazing. They take the idea of composition and extend it in a very elegant way. Instead of following the functions you follow the flow of data.
function application notation:
f(g(h))
pipes:
h | g | f
Its honestly pretty based to write your programs so that they can be piped in this way. You get to ignore values at this level. You're moving the data from one program to another without having to worry about the data itself. You only worry about the data when you're writing the program itself. Different programming styles at different levels.The use of pipes also allows you to reason about your programs algebraically.
That's the beauty of *nix. You implement your software in an imperative language like C where you have strict types. Once it reaches the level of programs sending values to one another, you're in the realm of things like pipes.
Check out concatenative languages. They're kind of in the realm of "toy languages" but they have interesting properties. Really makes you appreciate pipes. Also download "data oriented programming: unlearning objects". Excellent book. Data Oriented Programming is basically what React tries to implement in JS.
Cheers from an insomniac
Pipes are the epitome of UNIX brainrot. The reason is so simple that you can see it right there in your post.
f | g | h ≠ h(g(f(*~~
Every program needs a weird extra input that is sometimes there and sometimes not. Any other programming language would obviously ditch this moronic misfeature. Imagine if all Python functions had a random bonus stream input. It would be completely moronic. Any competent language designer would make x | y = y(x()), that would be so simple.
Why not do that in sh?
Because they needed a stream as input but designed a system so stupid that every function can only except strings. Instead of taking a step back and re-evaluating the design of the language when they hit this issue, they just give every function in it one extra input of the type they need.
Python of all languages actually solves this quite neatly, though it's syntax isn't suited for shell scripting. Instead of every function being an executable with a main entry point, you have libraries that are loaded and then wrapped in Python functions with FFI. That way you can do all of your shell scripting in a real programming language with types.
If Python had a bash-like syntax you could, without too much effort, set it up as a shell that is far better than POSIX sh.
Isn't it crazy how much better the python way is?
You can write a + b and have it actually add them together. You could have a program that takes numbers as inputs. You could have a program with two input streams. One that works on a stream of integers instead of a stream of characters. A program could have multiple functions in it. You wouldn't need to have every program implement its own parser for the inputs. In turn this might eliminate all those different key/value file formats since a program could just take a dictionary of its settings as an input, and leave reading the file up to the shell.
It's hard to overstate how many things about personal computing would be improved by this small change.
Well, there's this
https://xon.sh/
Doesn't sound too stable, as most of Python's ecosystem, but neat regardless.
Fascinating, will check this out
Is a neat idea but i think i now understand why it didn't take off. Python's dependencies and package manager. Under the traditional model, is already kinda tricky to provide a base Python interpreter to do system tasks while giving the user room to install and manage another, probably better one (which you'll eventually if you work with Python) now you'd have to maintain a xonsh-like shim and ensure its modules play well along with the rest of the system (specially from a security perspective) and ensure xonsh doesn't do anything funny if it has a conflict trying to call the ones that come with user's custom Python version.
In theory, xonsh developer are smart enough and ensures its core functionality won't break if you put in your path another Python version within a bare minimum (i.e. 3.6 and beyond like it is right now) so xonsh can be a global module and let the user pick whatever version they want, and as the distros' official package manager wouldn't offer an older version than xonsh' minimum requirement, is on user's side burden if they get out of their way to frick it. However, hat's not an easy task to keep up for volunteers, and there's the deal with using venvs to maintaing legacy projects (that puts and old ass Python version in your path), or if xonsh just happen to update too fast.
>f | g | h ≠ h(g(f(*~~
How?
$ sed $(echo test) 's/e/w/'
sed: can't find label for jump to `est'
$ echo test | sed 's/e/w/'
twst
For a start, filename goes after the substitution string and you should be using <() not $(). I don't have bash in this PC but I'm sure if you wrote it as this you'd get the same result:
$ sed s/e/w/ <(echo test)
But anyway, parameters and stdin are different things. You wrote
>f | g | h ≠ h(g(f(*~~
f, g and h would include the parameters.
f := cat test
g := sed s/e/w/
h := less
cat test | sed /s/e/w/ | less
Is always the same thing as
cat test > file
sed /s/e/w/ file > file2
less file2
There is no formal equivalence here. Just because some programs happen to interpret their last argument as a file and open it doesn't mean those things are always the same.
In fact it is trivial that they are different.
If:
f = echo p
g = sed file -f
$ echo contents > file
For f | g
$ echo p | sed file -f
sed: option requires an argument -- 'f'
For g(f())
$ echo p > script
$ sed file -f script
contents
contents
∴ f | g ≢ g(f())
>For a start, filename goes after the substitution string and you should be using <() not $()
I am not making an error by accident. The $() is to pass the argument to the command to facilitate the proof that f | g ≠ g(f()).
All you do case is rewrite a pipe to look a little different. $() actually passes it as an argument.
I'm unsure what your point is
I don't get what your point is.
You didn't like my original justification for my claim, and said that it would hold if the functions where called in a specific order, so I gave you a counterpoint using that order.
If you don't get my overall point, I encourage you to go back and read
.
If a pipe was (as it should be) partial function application, they would be much easier to use. The issue is that you can't just move the pipe input to an argument because shell has no way to pass a stream to a function.
Their solution was to make every function take a single stream as an input.
Instead of streams being a simple and useful data structure, they have to be the basis for the entire shell. Even then you can only pass one of them to a given function.
It is blatantly horrible design.
>$ cat schedule.txt
>$
My sides
that doesn't seem safe
>Write a bash script
>It takes 15 seconds to execute
>Rewrite it in javascript
>feel the urge to take estrogen supplements
take the PowerShell pill anon
>Why yes, I do append -ExecutionPolicy Bypass everytime I execute a powershell command. How could you tell?
How are you going to execute JS on any system with no internet? Checkmate, autist.
>How are you going to execute JS on any system with no internet?
you can't run JS without internet? that sounds like BS anon ngl
it isn't. You can't run Python either because it's not installed by default on many systems unlike Bash. Bash is for max compatibility.
python is barely compatible with python
That's a part of it. Can't expect to execute 3 on systems with 2 and that's why, I believe, some Yandex tools were rewritten in 2 after a quick prototype in 3.
factual. reason i quit using python
>it's not installed by default
Then install it.
>because it's not installed by default
>yeah bro just write your torrenting script in bash in case the machine you're torrenting on doesn't have internet so you can't install node on it
lol
lmao
> works on my machine
The question was
> Why are we still using bash
Because "we" support airgapped and proxied networks. Frick your torrent or whatever, you can DL it with utorrent and never bother with Linux in the first place, for all I know.
no its true
are calling external libraries that use other languages really using those languages?
is not everything just binary? aren't we all binary programmers, at the end of the day?
maybe we're just atom programmers.
>no its true
but it works tho
If it's not a builtin or keyword, is it really bash?
OK ok it's a command interpreter as well as a shell, but is calling half a dozen external binaries in a script really bash?
We use zsh
Bash is better or worse suited for certain tasks regarding on what you want to do. Overall, if what you need to do with a shell requires calling TOO MANY external processes and rely on the correctness of their output to give it to something else (as opposed to, let's say, just throw a bunch of stuff to xargs and/or parallels and let them do the job) you're better off using something else in the long run, if you're relying on summoning external tools the language you choose doesn't matter much, all of them have to summon native processes, the point is taking advantage of the language's features to not do that when possible, and a real programming language has many of them over Bash's, i.e. Python's builtin JSON parser or requests instead of calling jq or curl.
Maybe if you stopped pipping sed into awk into grep into tr into sed into sort into uniq into wc and started learning Perl you wouldn't have this problem
>learn this deprecated shit language because you're moronic in the language you should be using
moron
Perl, as bash on steroids, is eternal. It's only deprecated as a universal language.
https://www.tiobe.com/tiobe-index/perl/
pffffffffffffffffftttttHAHAHAHAHAHAHA
not him but this contradicts nothing he said
you're right, you can still use obscure languages no one will ever use ever again if you really want to. you can use Pascal or Fortran if you really wanted to. good luck using those languages in any real setting though
>muh obscure
this still contradicts nothing he said and makes no point against using perl over bash
try harder zoomer-kun
>MUST DEFEND SHIT LANGUAGE
pffffffftthahahahaha
>they still can't make a single point against using perl over bash
heh
>they still can't make a single point against using fortran over bash
heh
sure i can, fortran isn't convenient for unix scripting, unlike perl which is not only more convenient but also faster than bash.
keep coping though
>muh convenient
convenient is a matter of opinion
kek, but speed isn't
>there are much more convenient
for unix scripting? for example?
>and fast languages
perl is infinitely faster than bash while at the same time being convenient to script in.
C is obviously faster than perl, but scripting and string manipulation is infinitely more convenient in perl. using C for op's json parsing problem would be moronic for example
You could even use perl to prototype a C program.
Perl gives you easy access to fork, pipe, select, fifos, sockets...
perl is slow as shit. cope. there are much more convenient and fast languages, you're an idiot haha
Still faster than any gayman approved interpreted language out there by a sizeable margin.
>gayman approved
IQfy meme idiot detected
>i need a fast language to run bash terminal commands
absolute fricking idiot as usual on IQfy
>doesn't know how to script
obviously
>i need a fast language to run bash terminal commands
How's Perl any slower and less suited for this task then? I amn't the one claiming that is slow as shit.
if you think you need a fast programming language to run shell commands then you've just revealed yourself to not know what you're doing and why, there's really no way around this OP
>if you think you need a fast programming language to run shell commands then you've just revealed yourself to not know what you're doing and why,
if you think that op's script would translate to a bunch of shell commands but in perl then you've just revealed yourself to not know what you're talking about. the only shell command he needs to run is that first qbt torrent one to get the json and then do all the looping and string manipulation with just perl, making the script much faster, which is what he was complaining about initially.
I amn't the one claiming that Perl is unsuitable to replace bash because is slow shit. You tell me. You're the one telling that speed doesn't matter for this task, i am just pointing out this.
For the record, i use Python frecuently, but when is pertinent, but Perl one liners are much more convenient when mixed on shell scripts compared with the different flavours and versions of AWK/Sed/Grep supporting different syntaxis and features present across a lot of different Unix boxes, and certainly better than dealing with different Python versions' for the right tasks.
use posix shell, you overengineering moron pajeets are so fricking dumb. MUH SPEED. for shell commands? no, moron
>for shell commands
again, that's where you're wrong. it's not a "shell command" script. it's a string manipulation script, which perl happens to excel at. using posix sh or bash for this forces you do said string manipulation with shell commands, which makes your script slower. perl is objectively an upgrade over shell in this case.
for string manipulation i would just use python, you don't need speed, just use the most popular thing. why make your life difficult
Python's regex is very similar to PCRE anyways. Besides, is handy for one offs. Nobody is writing deployment scripts on Perl but that doesn't stop it from being useful to clean up some logs ocassionally. Is just a tool that does it fine for problems of a smaller scope.
>you don't need speed
that's literally what this thread is about. op was complaining about the speed of his pajeet tier script, which he then rewrote in a slower language with better json support, giving the impression that it's faster
>just use the most popular thing. why make your life difficult
how does this correlate? a language's popularity has absolutely no impact on how well suited that language is for a given task, and the point i'm arguing is that perl is a better tool for this task than bash, and people started seething
Are you going to keep contradicting yourself just to not admit a non gayman tool can be handy for certain tasks?
anything i don't like is something called "gayman"
that's a nice baby duck syndrome you got there
Fortran is still widely used in scientific computing. Keep coping though zoomzooms
>TIOBE
pffffffffffffffffftttttHAHAHAHAHAHAHA
>TIOBE
let's compare x86, Python, Java and Fortan
LOL
use posix, then bash, then python, then c. that's it. everything else is totally irrelevant and for pedos
Anyone who thinks POSIX is anything more than a sad joke is an idiot, and their opinion can be safely discarded.
>I do not use it so no one does
use python you moron autists, cya
Python is garbage at everything. Perl is also garbage for most things, but it is at least good for text processing.
>still defending perl
kek unreal
I accept your concession.
use python, bye guys! 🙂
Python breaks almost every three minor versions, defeats the purpose of cross platform scripting. Is OK with Anaconda or docker but i wouldn't trust it for anything that touches files or network rules on more than a single bare system.
>Python breaks almost every three minor versions
nice lie, IQfy homosexual, it doesn't. the issue is you making up shit. python doesn't break, you're just a stupid homosexual. do you understand?
python sucks shit and only poojeets like yourself should use it.
You never have used it for anything but requests, right? Is a tool, not your ego. It has uses and flaws like everything else and lying about them doesn't change them. Or were the 3.6.x shitfests just a bunch of people on StackOverflow making shit up.
>Is a tool
the esl eurotard always reveals himself, fricking stupid homosexual europoor piece of dog shit is always the stupidest person on the planet
I don't like being forced to use whitespace the way they want me to, and I'm pretty sure their variable scoping is pretty fricked. At least Perl and JS provide keywords and other restrictions to ensure you're using the variable you intend on using
By the way did they ever fix variable scoping in PHP? Last I checked you could declare one inside of a block but still have access to it outside of said block? That's insanity
tiobe's methodology is moronic, they basically put "(language) programming" into a some search engines and use that to determine their rankings. They have a detailed explanation here:
https://www.tiobe.com/tiobe-index/programminglanguages_definition/
sounds like someone is butthurt that their favorite language they can't give up is long dead
man history.3
history -cr my_bash_one_liners.txt && history -w
OP doesn't have a job, it's pretty obvious
>parseing json in bash
>without jq
>piping awk to grep to sed
OP by chance are you taking titty skittles?
what’s so bad about his bash script holy shit
nothing, OP is a typical IQfy idiot not knowing what he's doing or why. bash is great, posix shell is awesome too. both great for most things where you don't need ultra efficient performance or data manipulation, which is like 70% of things
Bash runtime is tiny compared to JS runtime.
>op was complaining about the speed of his pajeet tier script
shell commands don't need C language speed, stop a moron, posix or bash is fine, and if you need more of an ability to manipulate data use python. this whole "MUH REQUIREMENTS" thing is bullshit, just because someone says they need something doesn't mean they actually need it or know what they are talking about or know that they need or don't need what they're asking for
>you don't NEED speed!!!! because i said so!!
lmao anon, just give it up already. you can cope all you want about this but it doesn't change the fact that perl is the best tool for this task.
>MUST CLING TO PERL
cope
i'm not clinging to anything, in fact i wouldn't use perl for anything too complicated since it can quickly become unreadable/unmaintainable. i'm literally just saying that perl is the best tool for simple string manipulation tasks like the one op is showing, and so far you've said nothing worthwhile or concrete against that
>if you need more of an ability to manipulate data use python
Good luck writing a python one liner
Perl is suited for text transformation up to certain extend, there's a point where Python is preferable. Both are fine when the task requires it honestly.
Did OP just write a script to write a script then delete it.
I think he didn't know how to use a native shell command to exec the qbt tool. 2bh, i don't know how, either, i have never used Javascript as a system scripting language. Is it even possible to invoke a shell command on Node.js at all? One might think that not because that's out of JS design scope, but i amn't a expert.
yes it is possible
https://nodejs.org/api/child_process.html#child_processexeccommand-options-callback
this is clunkier than bash though by a lot, imho
Looks like something on the lines of a Heredoc could be useful for a script like that one, like the answers on this blogpost
https://scriptingosx.com/2021/11/the-unexpected-return-of-javascript-for-automation/
Or this
https://magnusviri.com/using-heredocs-in-apple-remote-desktop-to-run-perlpythonruby-code.html
Fricking painful since it still follows the shell token expansion, but doable with a lot of quoting.
much clunkier than bash, as clunky as python. shelljs makes it easier but that's an npm install away
I think the quickest way to solve OP's problem would be with a Heredoc as this suggest
is not by any means something that would scale well but OP's script is quite short so it wouldn't take much to properly escape all dangerous characters.
yeah op should deffo use a heredoc
morons can't do that
>Why are we still using bash, remind me?
Need more argument parsing errors. Funny online scripts that remove your home directory.
Licensing and momentum unironically. You can have two shells symlinked to the right spots, like Debian that uses dash for anything system wide and lets bash sit as the user interactive shell, so not that much usefulness on bash being POSIX compliant except on legacy systems. Features, process redirection aside, aren't groundbreaking enough to warrant the extra code surface and slowness (dash was created because bash was slow) in contrast with other modern shells that include many more at least. If bash hadn't come at the right moment and being the strongest GPL option available and integrated with the coreutils, i don't think it'd have gone too far.
why are YOU still using bash?
Just werks for the right tasks.
this thread is the biggest fricking cope. no one even uses perl anymore, what absurd level of cope is this?
I use Perl any time I can. It helps that modern JS is incredibly similar to modern Perl, and its hard to avoid having to use JS these days. The biggest differences are sigils, the order in which functions/keywords are chained together, and JS being slightly less expressive than Perl. Also you'll have a hard time finding a *nix that doesn't have Perl installed by default, and unless you're using some legacy unsupported release you'll have a very easy time dealing with whatever you're trying to do. Its ridiculously easy to bundle 3rd party CPAN modules too, so you don't have to worry about users not having those installed. I will say though, the core modules leave a fair amount of things to be desired. All of the <module name>::Tiny with lots of community support and large user bases should be included by default, and so should popular DB drivers.
bash is sexy and you are not
use posix, then bash, then python, then c. that's it. everything else is totally irrelevant and for pedos
i cannot believe someone is using perl still how moronic do you have to be kek that's dumb
That's easy to surprass. There're people using Javascript for writing CLI tools right now.
perl isn't even used anymore, good luck getting a job KEK
Jobs aside its a cleaner and more flexible version of bash and it's a great tool for system scripting. I still use it for prototyping web app backends but I accept that outside of maintaining legacy code and startups founded by autists such as myself there's next to no paying jobs for it
that's like saying shell scripts and awk aren't used anymore
shell is used all the time by everyone, so is awk. perl isn't. cya
perl is just shell combined with awk so there's no reason to not use it
>MUH ONE LINER
>MUH PERFORMANCE
>for shelll scripts
why is IQfy this stupid?
Unix is made of C and shell scripts. Shell scripting performance is extremely important to think about when most tasks are done on Unix-like systems.
>MUH PERFORMANCE
Yes that's what the thread is about
95% of the use a shell should've is chaining one liners and you can cite a ton of experts that behemontly agree, you shot yourself in the foot for being le epic hackerman against a non trendy DSL.
>Muh speed
Speed matters for specific tasks even on a shell, that's why the Debian fiasco came to be.
You only need JavaScript and Node for everything. Nothing else matters.
for bash commands you only need bash
why bother with perl, no point other than severe baby duck syndrome
Is faster than learning the differences among three versions of awk and sed and less limited than sticking to the POSIX ones, while still widespread enough among old and modern systems. Perl may not be the first language i'd reach to write CLI applications that handle lots of logic but the ability to do adhoc oneliners for text processing is handy when needed.
i learned perl after python, and i use them both. python just isn't as good as a sed/awk replacement.
#!/bin/bash
sleep 15
the perfect script doesn't exi-
Well yeah if you're going to do web scripts JavaScript is fine. But I assume most scripts aren't web related.
Not that many scripts use Bash specifically. Besides aren't you supposed to use Python or something at the point when stuff gets too complicated for the standard shell?
Mostly. There's a plethora of tools you'd use for CLI applications that outbeat old shell when you don't need portability, Python and Go (when you need something more reliably that doesn't involve data science) being the hottest kids on the yard lately, but there's also Perl, Lua, Tcl, some Scheme/Lisp implementations, Deno with Typescript, any JVM with GraalVM. Is all on personal taste and requirements. Overall, tying yourself to a single shell like Bash isn't worth unless your scope is narrow (only your own system or very homogeneus ones you've access to) for the inconsistence on availability of features (Bash 5.0 is different from Bash 4.0 and earlier, very corcening metacharacters interpretation bugs fixed on later releases i.e.) if you're going to deal with that, is better use a proper programming language.
Better type safety
There are people in this thread that don't have comfy jobs writing perl for 200k+?
Sad.
there are neets who aren't paid 200k an hour to write sed scripts?
ITT:
>perl is bad because... because muh popularity contest! just settle for this inferior solution instead!
kek do zoom zooms really?
bash is useful for command line work, python is useful for data manipulation, c for speed. that's really all you need. everything else is troony shit
What, are we chads running jash now?
You mean this thing?
https://sourceforge.net/projects/jash/
What's the point when there's Groovy and soon Kotlin.
>bash comes pre-installed as the default shell on most GNU+Linux distributions
>Requires zero downloads and thus scripts can be run out of the box
This means absolutely no connection to the Internet is required and the scripts can be deployed to all machines quickly and easily.
Though I'd love to see exactly what bash scripts take that long to execute, even on a fricking Raspberry Pi zero
>Though I'd love to see exactly what bash scripts take that long to execute
Strace with timestamps can probably help with that.
>Write a bash script
>It takes 15 seconds to execute
why are you lying on the internet? every bash script i've ever written takes less than 1 second. what are you trying to do? what is the task you're trying to accomplish? your issue obviously isn't with the speed of bash, the issue if that you're a bad coder