[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology

Name
Options
Comment
Verification
4chan Pass users can bypass this verification. [Learn More] [Login]
File
  • Please read the Rules and FAQ before posting.
  • You may highlight syntax and preserve whitespace by using [code] tags.

08/21/20New boards added: /vrpg/, /vmg/, /vst/ and /vm/
05/04/17New trial board added: /bant/ - International/Random
10/04/16New board for 4chan Pass users: /vip/ - Very Important Posts
[Hide] [Show All]


[Advertise on 4chan]


File: Untitled.png (5 KB, 346x146)
5 KB PNG
why don't people like coding in bash anymore? it's so cvmfy
>>
>>108655591
I like it
>>
I coded large projects in it. It feels really cool and edgy, but once you need to revisit it years later, when you look at the code, even well structured, it's pretty rubbish. In retrospect, I would rather write stuff in Go.
>>
File: 1759871912124984.webm (1.99 MB, 202x360)
1.99 MB WEBM
>>108655591
xatnys tihs
>>
>>108655591
Bash is garbage
Cumfy isn't a word
>>
>>108656287
i didn't say cumfy, you did. why are you such a clown?
>>
>every "function" (binary) has it's own special snowflake signature conventions and only returns unstructured strings
joke language.
>>
this is a fish board.
>>
Aside from ffmpeg and some of my really old wifi hackerman scripts everything of mine is python.
>>
>>108655591
It's not really coding, more like scripting
>>
>>108656754
Both scripting and programming are coding.
>>
>>108655591
I've started to write most of my new scripts in nushell. I love types and functional-ish programming, but LLMs are pretty bad at it.
Bash has so many warts that I always have to look up again if I haven't used it for more than a few months, but again, llms solve this.
>>
>>108655591
Its hideous.
>>
>>108656838
I want to use murex to build a library for interacting with i3's window tree.
>>
>>108657091
it also has native json support, right? jq is nice, but for many tasks, these shells are much more fun and ergonomic for these tasks.
>>
>>108657302
Murex has a ton more than just json support.
>>
>>108657333
sure, but native json/csv support really blew my mind in nushell how it simplified scripts and made me automate much more on my computer, that's why i'm focusing on it
>>
File: guile.png (65 KB, 1280x690)
65 KB PNG
for me its guile
#!/usr/bin/env -S guile -e main
!#

(define (main _)
(system "echo fuck niggers!"))
>>
>>108657347
I was thinking about nushell, but murex has somethig called "typed pipelines," that goes a lot farther than structured data in tables.
~ ยป runtime --marshallers
[
"*",
"bool",
"columns",
"csv",
"float",
"generic",
"hcl",
"int",
"json",
"jsonc",
"jsonl",
"md",
"null",
"num",
"path",
"paths",
"qs",
"str",
"string",
"toml",
"xml",
"yaml"
]
>>
>>108657347
Rather than dealing with structured data, like nushell, murex treats the structured data as a data structure, and allows you to use the coreutils in pipelines that do more than just strings.
>>
>>108657358
>>108657390
can you expand? I couldn't really find anything concrete about it in the docs but I've been vaguely annoyed about everything being a table in nushell in the past so this might be interesting to me
>>
>>108657353
https://www.youtube.com/watch?v=Iof5pRAIZmw
>>
>>108657411
You'll basically have to dig up example code or ask an ai, but json, yml, etc, are converted into maps and can be treated as such within the scripting language, including substituent types like bools, ints, and floats. So you can update the map with a script and spit it back out as json. Or load up json from whatever source and use it as a data structure in your script, basically directly, because it's a map, or in bash terms, an associative array.
>>
>>108657411
The documentation includes this one cute example of grepping only errors from 'example-cmd' with the ? keyword.
example-cmd ? grep "File not found"
>>
>>108657489
I think I understand. It automatically serializes to json for external commands, while also providing a more imperative syntax?
this nushell code
let data = ($datastr | from json)
$data | select key1 | update subkey1 { |k| k + 1 } | to json | sed 's/a/b' | from json

would just be somewhat like the following in murex?
[codex]
$datastr[key1][subkey1] += 1
let result = $datastr | sed 's/a/b'
>>
>>108657599
Something like that.
From https://github.com/lmorg/murex/blob/master/examples/inline-sql.mx
#!/usr/bin/env murex
#
# This example uses SQL to filter output from a POSIX command

ps aux | select USER, PID, COMMAND where USER = `foo` order by PID ASC | head -n10

/#
Outputs:

USER PID COMMAND
foo 943 /usr/lib/systemd/systemd --user
foo 944 (sd-pam)
foo 954 /usr/bin/kwalletd5 --pam-login 6 8
foo 955 /usr/bin/startplasma-x11
foo 960 /usr/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
foo 987 /usr/lib/baloo_file
foo 991 /usr/lib/xdg-desktop-portal
foo 1004 /usr/lib/xdg-document-portal
foo 1008 /usr/lib/xdg-permission-store
#/


https://github.com/lmorg/murex/blob/master/examples/dictionary-api.mx
#!/usr/bin/env murex

words = list.join('%20' @PARAMS)

open https://api.dictionaryapi.dev/api/v2/entries/en/$(words) \
-> foreach {
-> [ meanings ] -> foreach meaning {
-> [ definitions ] -> foreach def {
$definitions <~ %[ {
partOfSpeech: $meaning.partOfSpeech
meaning: $def.definition
} ]
}
}
}

$definitions
>>
>>108657717
that second one is total trash. imagine writing that out from left to right with no newlines in the command line. even jq gets annoying as fuck when you need to go back and forth adding parentheses. doing sql and complex set theory in my head is a chore too.
>>108657599
this just looks like powershell. also way too verbose for the shell compared to jq. all of these always end up looking like basedlangs instead of what you'd use in the shell.
>>
>>108655591
Because babashka and node exist
>>
I used Bash many years ago and it was pretty bad.
Anymore if I need a quick script I unironically will just use C and compile it real quick, because it's easier even for string processing.
>>
>>108655591
I'm not a big fan of bash but I haven't seen anything better (python is disgusting)
>>108655661
# that's why you leave comments above blocks
>>
>>108655591
Because it's designed first as an interactive shell which leads to friction and gotchas the more you try to do anything serious. Perl was created to address these shortcomings and then various modern scripting languages have replaced perl in that niche by being more sane.
>>
>>108658896
>all of these always end up looking like basedlangs instead of what you'd use in the shell.
agreed, I still prefer bash for interactive usage. I use it for scripts once I need to deal with structured data, even arrays, or when I start writing stuff like
generator | while read x { ... }

properly shellchecked bash is also very verbose but looks more like gibberish
>>108657717
it definitely looks like its more concise than nushell in many areas, and some of this flexibility might help sometimes (though stuff like defining variables inside a deeply nested chain looks like a double edged sword for me wrt. readability). I guess I have to try it out to get a feel for it, hopefully LLMs can help a bit
Do you know whether it can do streaming processing? that's a big disadvantage of nushell for some workloads
>>
File: 1771268938335399.png (32 KB, 555x529)
32 KB PNG
>>108657353
tsmt
>>
Perl, et al. wouldn't exist if bash was sufficient.
>>
>>108655591
>python at home
Also
>python for boomers
>>
>>108655591
Bash isn't code it's basic computer usage even windows has it holy shit.
>>
>>108655591
bash is certainly a language, i won't call it good but not bad either, in terms of quickly cobbling something together is more "ergonomic" than python for the stuff where you are just using system utils and leveraging existing command line programs.
that said once you need to reach for arrays it is a sign that you should either switch to a different language or rethink how your program works.

that said lately i've been writing more posix shell than bash, not out of the need to be an insufferable hipster cu "i don't use them bash features" but rather for the small utils i'm cobbling in posix shell to be more portable without having to reach for something like C, ada or go as even the most complex thing i'm building i feel would only exponentially balloon in complexity if i were to reach for something lower level than shell and if i didn't care about portability so much bash would not offer massive benefits to barely any benefit at all as code would be just as extensive with the usage of bashisms probably producing less readable code, not that reaching for bashisms DO inherently produce less readable code but the way many a scripters use bashisms do tend to that...
>>
I wish I could write LESS bash. Perl becoming untouchable was such a mistake it's unreal.
>>
>>108666637
perl is a good idea on the surface, unfortunately it is a write only language, so either you get it right the first time or re-write it until you get it right eventually...
>>
>>108666670
>unfortunately it is a write only language, so either you get it right the first time or re-write it until you get it right eventually...
How is this any different from shell scripts?
>>
>>108666687
shell scripts are readable, even if they are poorly written in an obscure dialect there will be some script out there in the internet that makes use of the same features but is actually well written and commented so it can be used as a sort of rosetta stone to translate the worse dialectic script.

the same doesn't happen with perl, perl by nature is horribly dialectic with more ways to do things than c++ has ways to shotgun your foot off, all those ways equally as bad and unreadable, to the point that while C and C++ have competitions about writing obfuscated software, perl has competitions about writing the most unobfuscated sotfware, and over 80% of the submitted code doesn't even qualify as unobfuscated enough to enter the competitions...



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.