13 hours ago

Avis aux #Mastopotes , si à partir de 15h30 environ, vous voyez passer des questions #bash ; #python ou #PowerShell ; dont la réponse vous est évidente, n'hésitez pas à répondre (enfin, si vous comprenez l'énoncé, c'est souvent ça le problème aussi)

Tim Van Dijck
14 hours ago

Need to locally rerun a command every time it finishes? This simple snippet will do just that! #bash #programming

Travis A. Everett
23 hours ago

Just noticed that infinisil spent a little time on in The Nix Hour a few weeks back.

Also realized how helpful it is to be able to watch someone else try to grok your docs in real time :)

#nix #bash #Shell #resholve

binaryphile :clippy:
1 day ago

This works really well, since you can just use #bash's or (`||`) operator when something fails like so:

false "I'm guaranteed to fail" || die "Yup, I failed!"

but it has the side-effect of needing to explicitly set the return code prior to calling `die` if you want to control it instead of using the rc of the prior command. That ends up being awkward.


binaryphile :clippy:
1 day ago

I used to always use my own `die` function in all of my #bash scripts to spit out a message and exit (inspired by perl, I believe?). It would look like:

die "I'm dying for reasons!"

and the script would stop and possibly have an error code as a result.

The first thing the function would do was save the result code from the prior command (`$?`) and use that as its return code, and also to control whether the message appeared on stderr (rc > 0) or stdout (rc == 0).


Cask Fan
1 day ago

So having found out that it was playing dvds that caused all my freezes I've gone back to #MXLinux which I liked from the start. So after a morning installing the latest #Python, a decent version of #Vim, #VSCode, and getting #bash configured the way I like it, I'm back to where I was a week ago.

2 days ago

I've set up a simple bash script to update a DNS record for my domain with CloudFlare whenever my home IP address changes, this effectively using CloudFlare as Dynamic DNS service:

#bash #DNS #CloudFlare #SelfHosting #DDNS

2 days ago

#bash 1-Zeiler. Linux mit grafischer Oberfläche (KDE, Gnome).
#Musik stummschalten -einschalten . "clementine" kann gegen "vlc" oder andere Player getauscht werden

dbus-send --session --type=method_call --dest=org.mpris.MediaPlayer2.clementine /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause

2 days ago

Unable to List Contents or Create Files in /var/tmp Folder from PHP Executed Bash Script #bash

2 days ago

Allez, ça faisait longtemps que je n'avais pas écrit sur mon blog...

#bash #prompt #linux

Falk Heiland 🇺🇦
3 days ago

@GrahamDowns i do not think a #Powershell user will take offense. PowerShell is not a pure shell though, it is an object oriented scripting (programming) language with a shell.
i am pretty sure most ps users use #bash (or another unix-shell) as a default shell on linux.

just discovered the `less` bash command does a pretty nice job reading PDFs from the command line and only outputs the text

#linux #bash

3 days ago

#Bash kann rechnen :


## mit ganzen Zahlen
echo $(( B+C ))

## mit rationalen Zahlen
echo "$A/$B" | bc -l

Graham Downs
3 days ago

My word, can Microsoft not do anything right? Compared to #bash, PowerShell is a hideously verbose, ridiculously complex shell, and I can't imagine why anyone would want to use it.

In my opinion, of course. If you're a #PowerShell fan, I apologise, and I meant no offense. :)

Scripter :verified_flashing:
3 days ago

Linux-Terminal-Basics 12: Schleifen mit for, while, until | #Linux #Terminal #Bash #Schleifen

3 days ago

Script en bash que comprueba si hay internet y ejecuta unos programas #Linux #Scripts #Bash

Script en bash que comprueba si hay internet y ejecuta unos programas #Linux #Scripts #Bash
3 days ago

Grabar una iso en un Usb desde la terminal con dd #Linux #Terminal #Bash

Grabar una iso en un Usb desde la terminal con dd #Linux #Terminal #Bash
4 days ago

.desktop file to launch shell script (ROS, kitty) #2004 #bash #scripts #desktop #ros

4 days ago

#Bash kann auch Arrays. Nativ ist das Array 1-dimensional

Sehr einfaches Beispiel: schreibe 3 Werte in eine Datei,. lese dann zeilenweise in ein Array und zeige den Inhalt an.

echo "a
c" >lolo.txt
readarray x <<< $(cat lolo.txt)
echo ${x[@]}

So ... I'm playing with a report showing how often F500 companies are mentioned in HN submission titles.

As I've noted, most of my scripting is in awk (gawk), and it's ... usually pretty good.

I'm toying with a couple of loops where I read all 178k titles, and all 500 company names, into arrays, then check to see if the one appears in the other.

The first iteration of that was based on the index() function, which is a simple string match. Problem is that there are substring matches, for example "Lear" (the company) will match on "Learn", "Learning", etc., and so is strongly overrepresented.

So I swapped in match(), which is a regular-expression match, and added \W as word-boundaries.

The index-based search ran in about 20 seconds. That's a brief wait, but doable.

The match (regex) based search ... just finished as I'm writing this. 13 minutes 40 seconds.

Regexes are useful, but can be awfully slow.

Which means that my first go at this --- still using gawk but having it generate grep searches and printing the match count only ... is much faster whilst being accurate. That runs in just under a minute here. I'd looked for another solution as awk is "dumb" re the actually output: it doesn't read or capture the actual counts, so I'll either have to tweak that program or feed its output to an additional parser. Neither of which is a big deal, mind.

Oh, and Apple seems to be the most-mentioned company, though the F500 list omits Google (or YouTube, or Android), listing only Alphabet, which probably results in a severe undercount.

Top 10 using the F100 list:

1 Apple: 2447
2 Microsoft: 1517
3 Amazon: 1457
4 Intel: 554
5 Tesla: 404
6 Netflix: 322
7 IBM: 309
8 Adobe: 180
9 Oracle: 167
10 AT&T: 143

Add to those:

$ egrep -wc '(Google|Alphabet|You[Tt]ube|Android)' hn-titles
egrep -wc '(Apple|iPhone|iPad|iPod|Mac[Bb]ook)' hn-titles
egrep -wc '(Facebook|Instagram)' hn-titles

Note I didn't even try "Meta", though let's take a quick look ... yeah, that's a mess.

Up until 2021-10-28, "Meta" is a concept, with 33 entries. That was the day Facebook announced its name change. 82 total matches (so low overall compared to the earlier numbers above), 49 post-announcement, of which two are not related to Facebook a/k/a Meta. Several of the titles mention both FB & Meta ... looks like that's four of 'em.

So "Meta" boosts FB's count by 45.

There are another 296 mentions of Steve Jobs and Tim Cook which don't also include "Apple".

And "Alphabet" has 54 matches, six of which don't relate to the company.

Of the MFAANG companies:

Google: 5796
Apple: 2447
Facebook: 2371
Microsoft: 1517
Amazon: 1457
Netflix: 322

(Based on grep.)

#DataAnalysis #awk #grep #bash #HackerNewsAnalytics

Jack 👾
4 days ago

taking a #udemy course to up my #bash skills. 🧠

Vincent Dettmer
4 days ago

Using #zsh instead of #bash challenges me in unexpected ways. It forces me to explore intricacies of both shells to make it work how I like across machines.
I don't have a strong opinion about which I prefer, just a fun learning experience about things I took as given. Gives me a glimpse into why some folks adhere to #ksh
I use it as shell only, not for scripting.

today i forgot
4 days ago

To require an argument in a #bash function use `${arg:?error_msg}`:

func() {
local arg="${1:?"Argument required"}"
echo "${arg}"

#tip #bash

If you use your .bash_profile on more than one computer (e.g. synced via git)
, but some command not installed e.g. bat: you can avoid breaking cat like so:

command -v bat >/dev/null 2>&1 && alias cat="bat"

5 days ago

Winexe error NT_STATUS_LOGON_FAILURE executing script from Linux to Windows Server 2012 #networking #server #bash #scripts #samba

6 days ago

Alle docker images updaten. Dieser 1- Liner für #Bash ist nicht von mir, aber ich benutze ihn regelmäßig,

docker images | grep -v ^REPO | sed 's/ \+/:/g' | cut -d: -f1,2 | xargs -L1 docker pull

6 days ago

How to put sudo operations (apt-get) on a shell script? #commandline #apt #bash #scripts #sudo

6 days ago
6 days ago

Simple Linux Kernel Picker

I run Fedora in my home-lab as the base OS for my server. It works well for me but I do occasionally run into an issue where Fedora will make a new kernel available before the ZFS project has support for it. {...}

#BASH #Computers #GitHub #Linux #BASHScript #Fedora #GitHub #Kernel #Linux #ZFS

6 days ago

The shell date command is not correct #bash #time

@jonny I'd do #bash or rather #fish but I guess #Python is needed here.

Chuso Pérez
1 week ago

TIL: pressing Control-R twice in #Bash repeats the latest search.

1 week ago
1 week ago

~/.bashrc displays entries depending on how it is called #bash #environmentvariables #bashrc

Cdrik 🌻 :unverified:
1 week ago

Y a des pros d'API / Python / PeerTube / Bash ici ?

J'ai un problème pour transformer un programme #bash en #python que j'ai posté ici :

Merci 🙏

Daniel Gibson
1 week ago

Uhh.. when I have a function in Bash (let's call it fun() because it isn't), and call it like
$ fun > /dev/null
then - as expected - global variables modified in it are changed in the outer scope afterwards.
If I call it like
$ fun | tee /dev/null
they global variable with its current value is available in the function, but after the call it has the old value from before the call?!

#Bash, you drunk?

screenshot of a terminal running a bash script (see link). its output:
NUM_ERRORS outside: 0
 running fun
 NUM_ERRORS in fun(): 1
NUM_ERRORS outside: 1
 running fun > /dev/null
NUM_ERRORS outside: 2
 running fun | tee /dev/null
 NUM_ERRORS in fun(): 3
NUM_ERRORS outside: 2
Why is it 2 ?!
Open Source Pro
1 week ago

"Mit der Bash-Skriptsprache in Linux kann man Speicherplatz durch das automatische Löschen von alten Dateien sparen. Zum Beispiel: find /path/to/files* -mtime +7 -exec rm {} \; #Linux #Bash #OpenSourceTipps"

Choan Gálvez 🐐
1 week ago

Today in #chatgpt will make you dumber, a different senior programmer used it to create a #bash loop.

1 week ago

Grabar una iso en un Usb desde la terminal con dd #Linux #Terminal #Bash

Grabar una iso en un Usb desde la terminal con dd #Linux #Terminal #Bash
i am root
1 week ago

Shoutout to Atuin, which moves your shell history to a SQLite DB and keeps it synced, with end-to-end encryption, across hosts. Works with #Bash and #Zsh. First impression: 👍 👍

#Linux #macOS

1 week ago

My #achievements at age 15:

- Published an app on #Flathub, and more are to follow
- #GNOME Foundation Member
- Project member of two other apps, Upscaler and Cavalier
- Lots of #contributions to lots of other apps
- I know #Python and #Bash really well, am getting good at #Rust
- Got to know many cool #programmers and #OpenSource enthusiasts!

I'm quite proud of myself, to be honest!

Pinky Floyd
1 week ago
#POMONA, Calif. - Tickets are now on sale for #InNOut #Burger's 75th Anniversary #Festival happening later on this fall.

The big #bash is taking place Oct. 22 at the In-N-Out Burger Pomona #Dragstrip.

Finally, my first concrete foray in middleware audio for video games. A post about how I speed up the process of creating folders in a filesystem that mirrors a large number of Switches in a Wwise project.

Done on macOS with GNU bash.

#VideoGames #GameAudio #Wwise #Audiokinetic #bash #macOS

[object Object]
1 week ago

Practice #regex and #bash by "cheating" at wordle:
Start with your first guess:

cat /usr/share/dict/words \
| tr '[:upper:]' '[:lower:]' \
| grep -E '^.....$' \
| shuf | head -n 1

Then refine the command after each round. Note the location of the dictionary file is MacOS-specific.

Michael Zeevi
2 weeks ago

Is there any #bash #utility which can be used to wrap and modify output from other commands?

My specific desire/use-case is to add colors to part of the output from `terraform apply` - I'd like to make any "Creating..." strings be yellow, and any "Creation complete after *" strings be in green.

Perhaps some #terraform #plugin exists?

Zach Mitchell, PhD 🦀
2 weeks ago

Got bit today by shell incompatibilities. Apparently “jobs -p” in #zsh has a different format than it does in #bash. For all the niceties of Zsh and #fish, stuff like this makes me want to slum it and go back to Bash.

Jons Mostovojs
2 weeks ago

@benjamineskola agreed. Trying really hard not to plug my #bash post, but I argue there that for practical definitions, #bash's portability hits the sweet spot if we use a subset of it (which is still broader than #sh).

Jons Mostovojs
2 weeks ago

@htothedip assuming you understood the person correctly, I suggest remembering who suggested that and never ever listen to them again.

Reason: #zsh scripts are *not portable at all*. #Python is at least somewhat portable because most of computers have python in their system dependencies.

#Zsh is fringe (as #fish is) and a lot of the magic of #zsh is replicated with #fzf.

Anyhow... I find that the optimum portability for me is writing stuff in #bash.

blake shaw
3 weeks ago

#bashtop is a testament to the power of #bash

process monitor bashtop
3 weeks ago

I have this #Bash one-liner to get the amount of available memory on #FreeBSD, but I haven't been able to find a similar one-liner for getting the amount of free or used memory. Anyone who can help me out here?

sysctl hw.physmem | awk '{ print $NF }')"

@sataa @otfrom I'd really live to use #fish more, but sadly I'm stuck on #bash since "installing another shell" is seen as a "security risk" only topped to "installing a compiler" and "chown 777 everything"...

And currently all tools I've to use on #Ubuntu, #RHEL, #SLES / #SLED & Co. are depenent on #bash.

@otfrom I do avoid them as much as possible.

Sadly, unless all distros purge the RMS-tainted GNU trash, I'm kinda forced to use it in ~ some capacity ~ due to the socioeconomic requirement to do #WageWork.

Personally, I avoid using them at all costs whereever possible, but sadly all relevant distros still use #bash instead of #fish and #ChimeraLinux isn't something I can introduce or shove into production...

ricardo :mastodon:
3 weeks ago

50 #Bash Script Examples to Kickstart Your Learning :bash:

3 weeks ago

How do I remake this for windows?! Windows doesn't support 'xargs' command

docker ps -aq | xargs docker stop | xargs docker rm


Arne Babenhauserheide
3 weeks ago

To encode multiple #video files in parallel with maximum compression using a simple #shell command:

OK, OK, it has a few lines, but the compression is worth it. #av1 #ffmpeg #bash

@dolari also #Windows is #bloated #Govware, inherently insecure and.doesn't even come with the most basic tool out of the box, like a useable #shell (neither #fish nor #zsh nor #bash!)[#Linux Subsystem for Windows doesn't count as it's not default preinstalled and integrated] nor trivial things like a #PackageManager or working #updates & #upgrades.

Shit that Linux does for 15+ years now...

Mark Gardner ‍:sdf:
3 weeks ago

@ovid @htothedip @eric Nice thing about #Perl is there's less syntactical distance from #bash and #Unix shells of its ilk. Pythonistas consider that a bug. 🙁

Oh wow, TIL: When you do input redirection from a file in #bash, e.g.

python < foo.csv

the running command can actually stat() the stdin file descriptor and get the size of the input file! I would’ve expected that it’s more like “well, it’s your stdin, you can’t get the size for that, it’s a stream”.

And, to be fair, if you don’t directly associate the file to the command, it breaks. For example,

cat < foo.csv | python

won’t supply a size.

#Unix #Linux #POSIX #shell

Will Deakin
4 weeks ago

The sx layer in the GeoPKG uses the centre-line track-model overlay on OpenStreetMap #OSM rail data based on minimum point to track distance

The ox uses only OSM data for track and meta-data tags

TIPLOC and STANOX locations are matched using the #NetworkRail OpenDataFeeds #CORPUS dataset

Code is developed in #python using #Geopandas #networkx #osmnx #Momepy #Shapely and #bash shell

1 month ago

@daviwil how to set it up with #Emacs to get completion and lookups and instant documentation. For system scripting languages like elisp or even #bash there's so much content, both built-in and online, on how to build out. Yet from what I've experienced trying to jump into guix, guile code is a lot more "paste it in, if it breaks go back" than those which is unfortunate. Or is there a great tutorial I've missed?

Una de las cosas que más extraño de la red del pajarito son los bots, así que decidí (re)implementar mi favorito.

En un par de horas hice mi primer #bot de #Mastodon con scripts de #bash usando #curl en un servidor #Linux

@volcanes_cr_bot descarga imágenes del #volcanes del #Ovsicori #UNA por ahora solo publica al #Volcán #Poás

El código fuente lo publiqué con una licencia libre #gpl en Github por si alguien quiere implementar sus propios bots rápidamente y sin dolor.

Neil Brown
1 month ago, by @ellie, is a sqlite-based, sync-able, terminal history store.

This looks rather cool if you want to keep a common terminal history across multiple machines.

#Linux #bash

@hazelweakly I know and I really would love to see that.

Basically porting a lot of advantages from #snap, #fish and #PyCharm to #bash...

Pretty shure this would require either a derivative language [i.e. "enhanced bash" / "ebash"] or require some preprocessor approach like #Blitz [#BASIC] and #Sass [#TypeScript]...

IT News
1 month ago

Linux Fu: Supercharge Bash History - Having a history of shell commands is a great idea. It is, of course, enormously h... - #linuxhacks #featured #linux #bash

1 month ago

Hey, I go by the penname DROSOPHILIAC—you call me Dros or Drossy if you want. I'm 24 and am #nonbinary.

I'm a busy #bioinformatics student. I code in #Python but intend on learning #R and #Bash.

I also do electronic #musicproduction in #Reaper. I intend to finish my first album sometime this year. We'll see if I can throw some music up on the internet anytime soon.

Beyond that, I write #poetry and make #digitalart for fun and self-expression. I'm #autistic and generally quite #neurodivergent.

Thanks for reading.

1 month ago

Be very careful with #Linux, #distros only know how to #kill.
#root #bash #process #terminal

DJ Adams
1 month ago

New post: Improving my interactive #jq workflow with ijq, #bash and #tmux.

I'm a big fan of ijq and how it allows me to explore #JSON data interactively with jq expressions. With a small script I have improved my workflow by being able to capture the jq expression from ijq and use it easily on the command line.

Share & enjoy!

a screenshot showing ijq being used to explore some JSON
Anders Eknert
1 month ago

Rather than deciding on a scripting language that only some in the organization understands and enjoys — like #Python — consider a more inclusive option, like #Bash, which no one understands or enjoys.

Mark Gardner ‍:sdf:
2 months ago

@AlgoCompSynth @h “Readable” implies what the reader already knows how to read.

Your reply is to a post where I specifically said the point was about converting from #Bash.

If you don’t know how to read a #shell script you definitely don’t know how to convert it to another #programming language. You’ll be doubly handicapped if the new language is nothing like the old.

Mark Gardner ‍:sdf:
2 months ago

@h Oh, I don’t deny it’s useful. And you’ll never catch me saying it’s bad to stick with what you know if it gets the job done—that’s one reason I continue to use #Perl.

My main point was that it’s less work converting #Bash to Perl than to #JavaScript.

The “kids want JavaScript everywhere” was admittedly a little snark directed at the “continuous amnesia” of prior art (not unique to #JS developers but their sheer number means it’s *really* prevalent) as described here:

Mark Gardner ‍:sdf:
2 months ago

This is hilarious. A #Google engineer invented #zx, a utility to make command line scripting easier with #NodeJS, because at a certain point #Bash scripts get too complicated and you need a Real #Programming Language.

This is exactly #Perl's use case from thirty-six years ago. But the kids want #JavaScript everywhere and would rather it take more work to convert their ascended #shell scripts to a vastly different syntax.

#Unix #Linux #ProgrammingLanguages

Neil Brown
2 months ago

Backing up to a USB stick automatically via udev on #Debian #Linux.

Building on yesterday's discussion about automatic USB backups, here's a #BlogPost setting out how I have done it.


- a udev rule runs when a specific USB disk is detected
- it runs a script calling "at", scheduling a backup in one minute
- the disk mounts automatically and LUKS decrypts
- in one minute, the backup runs
- I get some desktop alerts as to status
- I remove the disk

#udev #bash

Antonio J. Delgado
2 months ago

I just updated, improved and translated my #bash script to set the wallpaper to a current image of Earth centred in a city with the actual light and shadow on it and some info. Using info from @wikipedia and @openmeteo

2 months ago

Index of Pat’s pinned toots:


Guide to Content Warnings

#BASH #strings
y=${x##*pid=}; echo ${y%%,*}
- - -
A properly worn respirator stops all variants of the COVID-19 virus -- past, present and future...
- - -
#race #film
A pseudorandomly selected list of ten films to critique regarding how they treat black actors/characters
- - -
A list of #abbreviations
- - -
What's wrong with this picture?

pic showing Christian Bale, Joel Edgerton, John Turturro, and Sigourney Weaver playing Egyptians, along with extras playing menial characters
2 months ago

Want(not need) help/w optimizing rando langs I've written working calculator gui cloud app servers,only rely on stdin stdout in #ada #awk #bash #basic #C #cplus #COBOL #CLisp #Forth #FORTRAN #Go #java #Lisp (mine) #Lua #Pascal #Perl #Python #R #Rust #Ruby #SED These all work and talk to the thin client @ other end of a socket just fine, but lots are my first ever app in language. LMK if you have smaller $lang calc under that. also looking for destupify stdio|powershell

Matthew Graybosch
2 months ago

@jaredwhite @cappiello @vanilla @bridgetown Oh, I know. I'd prefer to stick with back-end development (.NET, C#, ASP.NET, SQL Server) because I'm familiar with it and I only got into coding because it pays better than cleaning toilets, but I keep landing in projects that want full-stack so I must perforce adapt.

On my personal website, though, my stack is #make, #bash, #sed, #awk., #pandoc, #htmlXmlUtils, and #ImageMagick. Deployment is #rsync over #ssh. :)

Neil Brown
2 months ago

Automating actions in Nautilus (GNOME's file manager) with scripts:

A quick write-up of my successful attempt to get a context menu script in Nautilus, to copy a file and rename it by prepending today's date.

Simple, and it will save me a lot of irritation.


#Nautilus #GNOME #Debian #Bash #Linux

2 months ago

Not a lot of people know that Nancy Sinatra was a #sysadmin :

🎶 These scripts are made for borking
And that's just what they'll do
One of these days these scripts
Are gonna bork all over you
Are you ready, script?
Start borking


Dave Mackey
2 months ago

Anyone use any nifty tools for long-term archival of local #bash history? I generally take notes as I go but every once in a while I find myself wishing I could go further back in history to follow my complete line of thought. 🙂

#question #linux #recommendations

Paul Denya
2 months ago

Oh man, this one is incredible. Add to ~/.zshrc to set the current working directory to be the iterm2 tab title.

#zsh #bash #terminal #code

if [ $ITERM_SESSION_ID ]; then
precmd() {
  echo -ne "\033]0;${PWD##*/}\007"
Clayton Errington 🖥️
2 months ago

How about some digital Spring Cleaning this time of the year. Always a good idea to review your digital files and clean out your digital life as well. Something a data hoarder is not good at...

#100DaysToOffload post 26!

#windows #powershell #linux #bash #shell

Neil Craig
2 months ago

TIL that for years I've been using `ls --format single-column` to list all files in a dir but only the filenames (usually to pipe into something else), I could/should have been using `ls -Al1` which does the same but excludes `.` and `..`
#bash #shell