Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Workaday Wizard
Oct 23, 2009

by Pragmatica

Cybernetic Vermin posted:

...how does it fare if the filesystem changes under it as it is running (find after all is not super-clever about it, so what happens if files get doubly reported or fail to get reported at all)...

i wonder, what's your solution to this in any os using any language?

Adbot
ADBOT LOVES YOU

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe
Shell scripts would be fine, it only needs to work once

And I'd either deploy it with a Makefile or maybe ansible

Cybernetic Vermin
Apr 18, 2005

Shinku ABOOKEN posted:

i wonder, what's your solution to this in any os using any language?

depends a bit on what the circumstances require, but for example inotify watches to keep track of the piece you are currently working on is a very powerful tool to have available (of course has a command line program as well, but would have to run async and at that point i don't think anyone would defend the resulting shell script). in a context with better error handling (and dealing with signals) i would also be a lot more comfortable simply creating a snapshot to work on

or simply going with checking that the structure still agrees after a first pass

the key mostly being that you can in principle launch into as powerful tools are you prefer, with the infrastructure required to deal with it. whereas the guy who arrives later and tries to make the shell script do some inotify song and dance is bound to either go insane or break the world

should again add that this is all stepping outside the realm the original post was about, but that is sort of the point, a long-living shell script runs the risk of doing such steps

VikingofRock
Aug 24, 2008




Remember that time Valve used a large shell script and accidentally ran rm -rf / on a bunch of customers' computers?

MrMoo
Sep 14, 2000

I believe it was the Steam startup script in Linux and was performing a Stream client upgrade but the environment variable for the root of the installation path was wrong so oops rm -rf ${STEAM_ROOT}/ became rm -rf /.

Deleting directories on Unix is always inherently dubious. I'm sure you can cause a mess with Windows Powershell too though, but developers are unlikely to bundle that as a main executable.

MrMoo fucked around with this message at 19:11 on Nov 1, 2017

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe
Fucken lol

That could happen just as easily in any language though, nothing shell specific about it

Athas
Aug 6, 2007

fuck that joker

Poopernickel posted:

Fucken lol

That could happen just as easily in any language though, nothing shell specific about it

In most languages, referencing an unknown variable is an error, and not "woops, he must mean the empty string".

pseudorandom name
May 6, 2007

MrMoo posted:

I believe it was the Steam startup script in Linux and was performing a Stream client upgrade but the environment variable for the root of the installation path was wrong so oops rm -rf ${STEAM_ROOT}/ became rm -rf /.

Deleting directories on Unix is always inherently dubious. I'm sure you can cause a mess with Windows Powershell too though, but developers are unlikely to bundle that as a main executable.

The problem was that STEAMROOT="$(cd "${0%/*}" && echo $PWD)" was failing because NTFS-3g is garbage.

VikingofRock
Aug 24, 2008




Poopernickel posted:

Fucken lol

That could happen just as easily in any language though, nothing shell specific about it

Sure it could happen in any language, but it's a lot easier to make a mistake like that in shell scripts because of their unintuitive quoting rules and the way that they keep going by default instead of stopping when running into things which should be an error.

It's good that people are starting to wise up to things like shellcheck (to enforce good quoting) and set -euo pipefail, but it'd be even better if they just switched to a more reasonable language for anything that can't fit in a single find / grep / sed / awk / xargs pipeline.

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe
embedded linux, ship shell scripts eery day

eery goddam day

Olivil
Jul 15, 2010

Wow I'd like to be as smart as a computer

Lady Gagas Penis posted:

And so it begins.



not depicted: emacs user actually enjoying the poo poo

Condiv
May 7, 2008

Sorry to undo the effort of paying a domestic abuser $10 to own this poster, but I am going to lose my dang mind if I keep seeing multiple posters who appear to be Baloogan.

With love,
a mod


Poopernickel posted:

embedded linux, ship shell scripts eery day

eery goddam day

i thought embedded devs gave a poo poo about performance

aren't bash scripts even slower than ruby?

Soricidus
Oct 21, 2010
freedom-hating statist shill

Condiv posted:

i thought embedded devs gave a poo poo about performance

aren't bash scripts even slower than ruby?

one time I replaced hundreds of lines of ksh that took several minutes to run with about 20 lines of perl that did the same thing in milliseconds

gently caress shell scripts

OldAlias
Nov 2, 2013

Condiv posted:

i thought embedded devs gave a poo poo about performance

aren't bash scripts even slower than ruby?

??? no it depends what you're doing and bash is almost a given

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde

Soricidus posted:

one time I replaced hundreds of lines of ksh that took several minutes to run with about 20 lines of perl that did the same thing in milliseconds

gently caress shell scripts
challenge accepted

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe

Condiv posted:

i thought embedded devs gave a poo poo about performance

aren't bash scripts even slower than ruby?

not too common to use bash where speed is concerned, for sure - probably you're gonna ship something with a compiled language (or a plang if you're nasty)

but it's super common to use shell scripts in the init system, and anything related to it

also it's pretty common to grant single-command sudo privileges to a user so that programs they own can run a shell script that does very specific things like "delete these 12 files and then reboot"

Poopernickel fucked around with this message at 00:21 on Nov 2, 2017

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe
IMO well-written shell scripts start to fall apart around the 150 line mark, and bad ones around the 10-line mark

hobbesmaster
Jan 28, 2008

Condiv posted:

i thought embedded devs gave a poo poo about performance

aren't bash scripts even slower than ruby?

busybox has ash but not ruby

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe

Soricidus posted:

one time I replaced hundreds of lines of ksh

your problems:
- ksh
- hundreds of lines

Poopernickel
Oct 28, 2005

electricity bad
Fun Shoe
if you're janitoring Makefiles also, those are 95% shell script

spankmeister
Jun 15, 2008






Poopernickel posted:

if you're janitoring Makefiles also, those are 95% shell script

lol nice ninja edit

Ellie Crabcakes
Feb 1, 2008

Stop emailing my boyfriend Gay Crungus

Soricidus posted:

one time I replaced hundreds of lines of ksh that took several minutes to run with about 20 lines of perl that did the same thing in milliseconds

gently caress shell scripts
What were the scripts doing?

Soricidus
Oct 21, 2010
freedom-hating statist shill

Lady Gagas Penis posted:

What were the scripts doing?

querying a database, laboriously parsing the textual output via several temporary files, and printing a report. it was a really bad script

Truga
May 4, 2014
Lipstick Apathy
i don't think anyone should do everything by cli, but many (most?) computer toucher things are done about 3 billion times faster by cli, and cli commands are easily automated. there's an extremely good reason why powershell exists, and no matter how much i hate it because the commands are all too loving long and the auto-complete can be dumb as gently caress at times, it's still vastly better than "open contorl panel, click thing x43, press this, click ok x43"

i have a gui on my work laptop for a normal browsing experience and so i can have multiple terminal windows up at the same time effortlessly (screen/tmux can't compare to a decent window management and desktop environment like kde).

also, ansible is the better config mgmt system because redhat supplies a library of things like https://github.com/openshift/openshift-ansible which makes my job 99% easier since most community supplied config management poo poo is "task 0: disable selinux" so i'd have to do everything myself anyway.

also, i've written shell scripts longer than ~10 lines, but when it's just preparing a working environment or linking files and running commands linearly idc. if you have control flow in your shell script, you've done hosed up tho. incidentally, i have a legacy git server at work which is 100% loving shell scripts and breaks at the tiniest of breezes that i hope to replace by year's end.

Condiv
May 7, 2008

Sorry to undo the effort of paying a domestic abuser $10 to own this poster, but I am going to lose my dang mind if I keep seeing multiple posters who appear to be Baloogan.

With love,
a mod


hobbesmaster posted:

busybox has ash but not ruby

busybox could probably fit a decent scripting language if it didn't have to carry around the extra bullshit used to make the shell a lovely scripting platform

and yes, even ruby is a decent scripting lang compared to bash scripting

Workaday Wizard
Oct 23, 2009

by Pragmatica
cli sucks for displaying information

a gui can have images descriptions arrows hyperlinks tooltips graphs etc.

nothing sucks more than exploring nested data in a cli

Truga
May 4, 2014
Lipstick Apathy

Shinku ABOOKEN posted:

cli sucks for displaying information

a gui can have images descriptions arrows hyperlinks tooltips graphs etc.

nothing sucks more than exploring nested data in a cli

i think you'll see this graph app i made in ncurses is super good in text mode on my 8k monitor and furthermore

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

Truga posted:

i don't think anyone should do everything by cli, but many (most?) computer toucher things are done about 3 billion times faster by cli, and cli commands are easily automated. there's an extremely good reason why powershell exists, and no matter how much i hate it because the commands are all too loving long and the auto-complete can be dumb as gently caress at times, it's still vastly better than "open contorl panel, click thing x43, press this, click ok x43"

i have a gui on my work laptop for a normal browsing experience and so i can have multiple terminal windows up at the same time effortlessly (screen/tmux can't compare to a decent window management and desktop environment like kde).

also, ansible is the better config mgmt system because redhat supplies a library of things like https://github.com/openshift/openshift-ansible which makes my job 99% easier since most community supplied config management poo poo is "task 0: disable selinux" so i'd have to do everything myself anyway.

also, i've written shell scripts longer than ~10 lines, but when it's just preparing a working environment or linking files and running commands linearly idc. if you have control flow in your shell script, you've done hosed up tho. incidentally, i have a legacy git server at work which is 100% loving shell scripts and breaks at the tiniest of breezes that i hope to replace by year's end.

I've never used screen to replace windowing, but I have used screen a bunch of times to house long running jobs on servers that have a habit of kicking my ssh session thus cutting me off from the stdout of the job.

RFC2324
Jun 7, 2012

http 418

cis autodrag posted:

I've never used screen to replace windowing, but I have used screen a bunch of times to house long running jobs on servers that have a habit of kicking my ssh session thus cutting me off from the stdout of the job.

tmux is better for windowing anyway

hobbesmaster
Jan 28, 2008

Condiv posted:

busybox could probably fit a decent scripting language if it didn't have to carry around the extra bullshit used to make the shell a lovely scripting platform

and yes, even ruby is a decent scripting lang compared to bash scripting

take it up with the ieee

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

cis autodrag posted:

I've never used screen to replace windowing, but I have used screen a bunch of times to house long running jobs on servers that have a habit of kicking my ssh session thus cutting me off from the stdout of the job.

good thing that systemd is “breaking” this!

(by forcing the developers of screen, tmux, et al to actually think about what it means to have a disconnected session, and adopting APIs to implement the concept)

(which didn’t they refuse to do?)

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?
does RMS have thoughts about systemd

that could be amusing




in a similar way to when someone told him about lldb

hifi
Jul 25, 2012

eschaton posted:

good thing that systemd is “breaking” this!

(by forcing the developers of screen, tmux, et al to actually think about what it means to have a disconnected session, and adopting APIs to implement the concept)

(which didn’t they refuse to do?)

the killuserprocesses debacle felt like a really big hammer that nobody outside of systemd wanted

Condiv
May 7, 2008

Sorry to undo the effort of paying a domestic abuser $10 to own this poster, but I am going to lose my dang mind if I keep seeing multiple posters who appear to be Baloogan.

With love,
a mod


hobbesmaster posted:

take it up with the ieee

maybe i will :colbert:

RFC2324
Jun 7, 2012

http 418

eschaton posted:

does RMS have thoughts about systemd

that could be amusing




in a similar way to when someone told him about lldb

http://forums.debian.net/viewtopic.php?f=20&t=123341

He apparently doesn't actually give a poo poo, since it doesn't violate his 'its free!!!!' poo poo

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

RFC2324 posted:

http://forums.debian.net/viewtopic.php?f=20&t=123341

He apparently doesn't actually give a poo poo, since it doesn't violate his 'its free!!!!' poo poo

just wait until someone tells him that systemd can manage non-“free” jobs

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
He didn't think well enough of it to mandate its use in GNU's in-house Linux distro. That uses the GNU Shepherd instead, because lol puns

Where's the service configuration directory?

:rms2: There's no directory. There's a system declaration!

OK, it's not a directory. How do I add a service to it?

:rms2: You write a monadic description in Scheme!

Gazpacho fucked around with this message at 07:06 on Nov 3, 2017

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
guix has a service called cuirass. queer rear end. lol

Cybernetic Vermin
Apr 18, 2005

RFC2324 posted:

http://forums.debian.net/viewtopic.php?f=20&t=123341

He apparently doesn't actually give a poo poo, since it doesn't violate his 'its free!!!!' poo poo

yeah, for all his faults at least stallman is pretty consistent. in fact, being excessively consistent is one of his faults

he certainly has no particular love of unix as such, it has been clear all along that the choice of cloning unix was a matter of convenience, after his previous attempt to clone the symbolics software

Adbot
ADBOT LOVES YOU

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

Gazpacho posted:

guix has a service called cuirass. queer rear end. lol

Hahahajahahajahahahahajahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahshahahahahahahahah

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply