bash and python - /g/ (#105743654) [Archived: 673 hours ago]

Anonymous
6/29/2025, 4:08:11 PM No.105743654
bash_python
bash_python
md5: 409d9cdb8082c08786839059792d8a03🔍
I don't see the difference.
Replies: >>105743666 >>105743720 >>105743727 >>105743741 >>105743936 >>105744253 >>105744326 >>105745953 >>105746721 >>105746954 >>105747440
Anonymous
6/29/2025, 4:09:20 PM No.105743666
>>105743654 (OP)
yeah bro basically the same thing
Anonymous
6/29/2025, 4:11:50 PM No.105743680
Scripting in one of them doesn't make you want to kill yourself.
Replies: >>105743721 >>105743992
Anonymous
6/29/2025, 4:17:26 PM No.105743720
>>105743654 (OP)
the latter makes the former obsolete in terms of script automation. Plus, it's platform independent.
Anonymous
6/29/2025, 4:17:56 PM No.105743721
>>105743680
This doesn't narrow it down.
Anonymous
6/29/2025, 4:18:46 PM No.105743727
>>105743654 (OP)
trying doing floating point operations in bash
Replies: >>105743783 >>105743819
Anonymous
6/29/2025, 4:20:14 PM No.105743741
>>105743654 (OP)
one is fucking dumb, the other fucking stupid.
Replies: >>105743769
Anonymous
6/29/2025, 4:23:30 PM No.105743769
1743776300267060
1743776300267060
md5: 5f553a62290ec7d4117454388790f52e🔍
>>105743741
I am fucking both.
Anonymous
6/29/2025, 4:24:19 PM No.105743783
>>105743727
easy peasy
#!/usr/bin/env bash

awk 'BEGIN {
printf("°F temp "); getline c;
printf("°C temp %.2f\n", (c - 32) * 5/9);
printf("close enough ;3\n")
}'
Replies: >>105743830 >>105747383
Anonymous
6/29/2025, 4:27:51 PM No.105743819
>>105743727
.. | bc
wow
Replies: >>105743830
Anonymous
6/29/2025, 4:28:59 PM No.105743830
>>105743783
>>105743819
thank you for proving that python is the better scripting language
Replies: >>105743861 >>105743902
Anonymous
6/29/2025, 4:31:42 PM No.105743861
>>105743830
I only see people pointing out how ignorant that anon was.
Anonymous
6/29/2025, 4:35:28 PM No.105743902
>>105743830
>i-it doesn't count!!
Kek, every time.
Anonymous
6/29/2025, 4:38:45 PM No.105743936
>>105743654 (OP)
They have two different use cases.
Neither are good at the other's; You can do both with either, but at the cost of efficiency on either end.
Replies: >>105743992
Anonymous
6/29/2025, 4:44:29 PM No.105743992
>>105743680
yes, i also want to kys when using python
>>105743936
i would say that neither is good at its job, but bash at least doesn t act like a kumbaya faggot and isn t held at the same level as real programming languages
Anonymous
6/29/2025, 5:10:58 PM No.105744253
1725485537726346
1725485537726346
md5: 750efaafa13f0dbc6a9e8b9deb12731f🔍
>>105743654 (OP)
Bash is faster and has better syntax than pyjeet.
Anonymous
6/29/2025, 5:20:17 PM No.105744326
>>105743654 (OP)
I need less commitment to make a scriptie in BOURNE AGAIN SHELL
Anonymous
6/29/2025, 8:16:21 PM No.105745953
>>105743654 (OP)
Loop example

python
n = 0
while n < 3:
print("Oppression")
n += 1


bash

n=0; while [ $n -le 3 ]; do
echo "Freedom"; ((n++));
done
Replies: >>105746119 >>105746760
Anonymous
6/29/2025, 8:35:04 PM No.105746119
poop_snipd
poop_snipd
md5: 4d47d8bbdc9cda6024a06b6dc34f3f47🔍
>>105745953
Brutal.
pic related.

Beauty.
n=0; while [ $n -le 3 ]; do echo "Freedom"; ((n++)); done
Freedom
Freedom
Freedom
Freedom
Anonymous
6/29/2025, 9:29:11 PM No.105746675
Python is stupid for using spaces instead of tabs and no curly brackets
Anonymous
6/29/2025, 9:34:43 PM No.105746721
1_7Oq8kkCvf15IKJFCqhpCqw
1_7Oq8kkCvf15IKJFCqhpCqw
md5: cb229ab47a5008151c90d8347d4a801c🔍
>>105743654 (OP)
I prefer pic related, too bad you need Maven shitware to download dependencies, though is good enough as a no dependencies Bash+ language.
Anonymous
6/29/2025, 9:40:02 PM No.105746760
1733710145590673
1733710145590673
md5: 2c1985c4f3b86d94ec5be8b574d93e6f🔍
>>105745953
You wouldn't write it like this in both languages.

python
for _ in range(3):
print("something")


bash
for _ in $(seq 3); do echo "something"; done


If I need to call programs installed on the system (like with seq in the example above), then I usually use bash. If I need data structures, e.g. a hash map, then I use Python.
Replies: >>105746878
Anonymous
6/29/2025, 9:55:42 PM No.105746878
>>105746760
bash has associative arrays
>$(seq 3)
{1..3}
Replies: >>105746908
Anonymous
6/29/2025, 9:59:58 PM No.105746908
>>105746878
I usually try to write posix sh scripts, so I rarely use these, but itt it's about bash, so good point
Replies: >>105746939
Anonymous
6/29/2025, 10:04:19 PM No.105746939
>>105746908
>try to write posix
can I ask why, as someone who does not
Replies: >>105747088
Anonymous
6/29/2025, 10:05:54 PM No.105746954
>>105743654 (OP)
i honestly prefer shell
because code manipulation is integrated at the syntactic level
i could use either
Anonymous
6/29/2025, 10:18:09 PM No.105747054
>bash
do you use word 'bash' to describe shell scripts in general? do you mean the fairly recent bash version that comes with your loonix or the very outdated and different 2007 one that comes with tim apple? do you test on both to ensure portability? do you rely on features of exclusive to coreutils or busybox or something else? are your scripts posix compatible? do you know what unavoidable non-posix behaviors modern shell builtins have (e.g. 'echo' having opts)? do you know if and why your sed or grep calls don't work on some systems? do your scripts rely on commands that only linux or bash ships (e.g. disown or pidof)?
Replies: >>105747074 >>105747156
Anonymous
6/29/2025, 10:20:28 PM No.105747074
>>105747054
also - do you know about various different regex variants that shell itself and the distributions of sed, grep, awk implement? do you know which ones are portable?
Anonymous
6/29/2025, 10:21:55 PM No.105747088
>>105746939
>can I ask why, as someone who does not
When I learned shell scripting, I thought it's a good idea to write portable shell scripts without any "bash-isms", so you could even use them on a system where only plain old sh is available. But for personal scripts this is pointless, so I should probably look into what bash has to offer.
Replies: >>105747144 >>105747267
Anonymous
6/29/2025, 10:27:25 PM No.105747144
>>105747088
>But for personal scripts this is pointless
until you got to figure out anyway why your personal script doesn't run on macos (ooold bash) from the work or 'in docker' (ash sh on distros like alpine)
Anonymous
6/29/2025, 10:28:42 PM No.105747156
>>105747054
GNU/Linux is all that matters
Anonymous
6/29/2025, 10:42:02 PM No.105747267
>>105747088
fair enough, 2bh llms are good enough now that they barely require writing
Anonymous
6/29/2025, 10:53:44 PM No.105747383
>>105743783
that's awk
Replies: >>105747807
Anonymous
6/29/2025, 11:02:09 PM No.105747440
>>105743654 (OP)
one is useful for everything so long as you don't care it's 60x slower than a real programming language like C or Fortran
one is useful for scratching the autistic 'use the right tool for the job' minimalist urges
Anonymous
6/29/2025, 11:37:21 PM No.105747807
>>105747383
It clearly says #!/usr/bin/env bash as well, faggot.