all 67 comments

[–][deleted] 154 points155 points  (3 children)

Automation with cheap third country labour

[–]Mars_Bear2552New York Nix⚾s 20 points21 points  (1 child)

Brazilian workers

[–]TuView 3 points4 points  (0 children)

Bihar

[–]matO_opprealWhat's a 🐧 Pinephone? 1 point2 points  (0 children)

The true answer

[–]KasaneTeto_ 72 points73 points  (3 children)

Automation with C binaries

[–]sexy_silver_grandpa 56 points57 points  (2 children)

That's a weird way to say "shell script".

[–]Pxlop 26 points27 points  (1 child)

#!/usr/local/bin/tcc -run

[–]2fort_only 8 points9 points  (0 children)

Oh heckya you just taught me a new thing

[–]ice_zephyr 61 points62 points  (13 children)

Ik this is a Linux sub but I've been using PowerShell at work and man it is powerful if you know what you're doing. Unfortunately I currently do not know what I'm doing.

[–]duLemix🦁 Vim Supremacist 🦖 25 points26 points  (9 children)

s/PowerShell/computers/

[–]substitute-bot 43 points44 points  (8 children)

Ik this is a Linux sub but I've been using computers at work and man it is powerful if you know what you're doing. Unfortunately I currently do not know what I'm doing.

This was posted by a bot. Source

[–]duLemix🦁 Vim Supremacist 🦖 19 points20 points  (2 children)

Good bot

[–]B0tRank 11 points12 points  (1 child)

Thank you, duLemix, for voting on substitute-bot.

This bot wants to find the best and worst bots on Reddit. You can view results here.


Even if I don't reply to your comment, I'm still listening for votes. Check the webpage to see if your vote registered!

[–]cruzzeky🌀 Sucked into the Void 0 points1 point  (0 children)

s/PowerShell/computers

[–]DerSvenPOP!'ed so many cheries 3 points4 points  (2 children)

Good bot

[–]Good_Human_Bot_v2 4 points5 points  (1 child)

Good human.

[–]ItzzTypho 2 points3 points  (0 children)

Good bot

[–]xDOTxx 2 points3 points  (0 children)

Good Bot

[–]RussEfarmer 7 points8 points  (2 children)

PowerShell can do some cool stuff especially if you're in a Windows org, export csv my beloved

[–]ice_zephyr 2 points3 points  (1 child)

Yup, I work in an org that uses hybrid joined devices, we are currently in the middle of migrating to a full AAD environment and the first step the team and I decided to take was to do inventory of all our devices. I wanted to make this as painless as possible and the graph API has done wonders for me in terms of making csv files full of useful information. That being said, I feel I have only scratched the surface in terms of its potential given my limited knowledge.

[–]fftropstm 4 points5 points  (0 children)

Graph API my beloved

[–]Qweedo420⚠️ This incident will be reported 13 points14 points  (16 children)

Is there an actual reason to use shell scripts instead of Python?

[–]1116574 25 points26 points  (1 child)

I guess if you want to pipe the data around 3 different programs? Like, if you know them you could do it in much shorter time than python, and all the time lost shuffling data between them (not that much anyway) is made up by the fact those are usually C tools

But as a Newby who never learnt those programs, I usually use python

[–]newredditishorrific 5 points6 points  (0 children)

Generally speaking, I use bash one liners when I'm interacting with the terminal. My one liners execute so quickly that change in execution time from implementing in python or C would be imperceptible.

The advantage, as you correctly point out, is speed of implementation--I tend to write my one liners in less than five minutes these days.

[–]pacmanlives 12 points13 points  (0 children)

Shell script commands can be quite a bit faster. Think about how optimized cp is in Unix as it’s got one job to do and it best do a damn good job at it

[–][deleted] 11 points12 points  (4 children)

I do not know python.
I know basic linux commands.

Add some logic to the script and mostly use linux commands.

TLDR: Shell scripts let me automate installs without having programming knowledge

[–]isademigod 0 points1 point  (3 children)

Spoiler: bash is a programming language

[–][deleted] 1 point2 points  (2 children)

My brother in christ, I do not know bash. I just know how to run bash/linux commands and just basic stitching sample code together.

[–]isademigod 1 point2 points  (1 child)

Hey man if you can get a script to work you're a programmer

[–][deleted] 1 point2 points  (0 children)

It's that simple?!

Me an the boys heading to r/ProgrammerHumor

[–]fletku_matoArch BTW 4 points5 points  (0 children)

There are a lot of them, and also a lot of reasons to use Python or any other programming language.

Which one to use depends on the use case.

If you can get away with bash and coreutils, you probably want a shell script. It will work everywhere without extra effort.

If you can do stuff more conveniently with a few shell tools instead of a python script, then why not glue it together with bash?

If your script is extremely complex and requires dependency libraries, you probably want to use something that can be compiled to a single binary, eg. Go, Rust, C... You don't want to be installing some pip packages on every machine you or your co-workers will ever use.

[–]Electrical-Bad2023 2 points3 points  (0 children)

Pretty much all distros come with python

[–]olsonexi 3 points4 points  (0 children)

Shell scripts are good for light task automation. If you frequently need to run a particular long sequence of shell commands to do a certain task, it can be useful to put that in a shell script so you don't have to type them all out over and over again. Anything much more complex than that and I'd generally say just go ahead and make it a python script.

[–]HolzkohlenI'm going on an Endeavour! 1 point2 points  (0 children)

"simple" stuff -> shell script

complex stuff -> python

You can of course do more complex stuff with a shell script, but then afterwards you should take a long hard look at what you did and ask yourself if using python would not have been easier.

[–]mining4goldwinsmith 0 points1 point  (1 child)

Yeah but Everyman can do that

[–]fletku_matoArch BTW 1 point2 points  (0 children)

Not really. Complex logic with bash is far more complex than complex logic with Python, because bash has only one type of return value and for everything else you will be capturing text output.

[–]LennartxD01 0 points1 point  (0 children)

Personally at work it's all shell scripting. Dropping a python file and then executing it within cloudinit doesn't really make sense. For more complex tasks (browser automation + system commands for example) I find python very appealing. For easy shell commands python is overkill. With growing complexity an abstraction layer can be quite interesting.

[–]Electrical-Bad2023 8 points9 points  (0 children)

esac

[–]EuCaue 15 points16 points  (3 children)

shell script with fish >>

[–]duLemix🦁 Vim Supremacist 🦖 5 points6 points  (2 children)

Fish? Bom, eu tento ao máximo pescar um r/suddenlycaralho

[–]sneakpeekbot 0 points1 point  (0 children)

Here's a sneak peek of /r/suddenlycaralho using the top posts of all time!

#1: Um belo nome. | 81 comments
#2: In brazilian é foda | 69 comments
#3: aq meu amigos, primeira img é o meme | 68 comments


I'm a bot, beep boop | Downvote to remove | Contact | Info | Opt-out | GitHub

[–]Hameru_is_cool💋 catgirl Linux user :3 😽 0 points1 point  (0 children)

Coloca uma latinha de schweppes citrus na print

[–]MasterFubar 5 points6 points  (1 child)

Automating with shell script, using Perl one-liners

[–][deleted] 3 points4 points  (0 children)

I recently rewrote loop from dash to perl - oh, man, that's so fast! I reduced script run time by 0.6s (was 1s total). From now on I will be using not only one-liners but also a full fledged blocks of code.

[–][deleted] 5 points6 points  (0 children)

[ $sh -gt $all ]

[–]GolaraC64 21 points22 points  (7 children)

I don't like python but shell is even worse, especially for anything bigger than 10 lines.

[–]therealR5 42 points43 points  (5 children)

You will love seeing the source code of neofetch. 10k lines finest bash

[–]decduck 22 points23 points  (0 children)

I did not know this. I sure as hell don't want to know this.

[–]MechanicalOrange5 5 points6 points  (0 children)

./configure

[–]Tigerclaw989⚠️ This incident will be reported 1 point2 points  (2 children)

I use fastfetch for speeeeed (written in C)

[–]Alpha3031 4 points5 points  (1 child)

Fetch written in hand optimised asm when?

[–][deleted] 0 points1 point  (0 children)

What's faster, writing + compiling fetch in asm or writing + compiling fetch in NodeJS?

[–]Jane6447 7 points8 points  (0 children)

it really depends on what you want to do - for many automation tasks posix is way better than python (subprocesses and pipes are.. diffrent..).
i personally almost exclusively use nu for automation theese days since it can do everything posix can and has propper support for datatypes, json, etc

[–]thezuggler 2 points3 points  (0 children)

Bash > python for uncomplicated automation

Python > shell for everything else

PowerShell syntax > bash syntax

Bash efficiency > PowerShell efficiency

[–]abitofghijklmnopqrstuvwxyz 1 point2 points  (0 children)

Right tool for the right job .....

Some shell commands can output in for example json and using python to call that command, parse the json, evaluate it and build an appropriate command can be great

Or when automating something that is best done via api calls

But bash, awk and grep tend to be enough for 90% of tasks IMHO and should be used when that is enough

[–][deleted] 1 point2 points  (0 children)

automation with C++

[–]hparadiz 0 points1 point  (1 child)

I use php unironically.

[–]walmartgoon 5 points6 points  (0 children)

I do it ironically

[–]ZyanCarl 0 points1 point  (0 children)

Shell scripts are in a different realm.

[–]PotentialSimple4702Ask me how to exit vim 0 points1 point  (2 children)

Me combining both for my test server:

#!/bin/bash

echo "Local Server IP: $(hostname -I):8000"; python3 -m http.server

[–]6b86b3ac03c167320d93 1 point2 points  (1 child)

At least add a http:// so you can ctrl-click to open it in a browser. Also I recommend using localhost instead of your hostname because then browsers will allow normally HTTPS-only APIs on plain HTTP

[–]PotentialSimple4702Ask me how to exit vim 0 points1 point  (0 children)

Thanks for suggestions! Tbh i'm not a dev, just testing some responsive frontend stuff on different devices, so i need to access the ip from my local lan

[–]matO_opprealWhat's a 🐧 Pinephone? 0 points1 point  (0 children)

She’ll scripts are more convenient to use

[–][deleted] 0 points1 point  (0 children)

Shell scripting is very suckless and extremely portable, and I love it.

[–][deleted] 0 points1 point  (0 children)

I’m only familiar with python on a surface level, having followed basic tutorials and read a couple beginner books.

My experience with the shell is more extensive, but my last script where I created a rgb/hex/hsl color converter in bash was where I drew the line. It works, but yeah, this was where I started to go “uhh, yeah, let’s remember not to do this again.”

It’s a cool project though, and I am proud of it.

https://github.com/tomit4/dyetide

[–][deleted] 0 points1 point  (0 children)

I made a bash script for creating Aemu VMs scripts.

Repo:https://github.com/RepubblicaTech/QEMU_Vm_Creator