dusnm, to random
@dusnm@fosstodon.org avatar

No matter how many times I write a shell script it always feels like partaking in an act of arcane sorcery.

The syntax is so unintuitive, but the finished product is enchanting in its beauty. Weird.

alephoto85, to linux Italian
@alephoto85@livellosegreto.it avatar

[RECENSIONE] Insegnare Linux agli sviluppatori di software con questo libro

@programmazione

"The Software Developer's Guide to Linux" affronta bene i fondamenti e le parti importanti del filesystem Linux, della riga di comando, della manipolazione dei file, dello scripting di shell e altro ancora.

Per soddisfare gli sviluppatori di software, il libro tratta anche Git e Docker.

https://itsfoss.com/software-developers-guide-linux-review/

awoodsnet, to php
@awoodsnet@phpc.social avatar

As I prepare my Tek talks — “Shell Scriptung for PHP Developers” and “Better Dotfiles” — are there specific issues/aspects you’d like me to cover?

awoodsnet, to Bash
@awoodsnet@phpc.social avatar

Are there particular challenges you have - or maybe a function you wish you had - when shell scripting using dates/times ?


awoodsnet, to Bash
@awoodsnet@phpc.social avatar

Bash Tip:

There are 2 ways to create a function in Bash

function hello {

your code here

}

or

hello() {

your code here

}

using the function keyword and the empty parentheses is rendundant

awoodsnet, to Bash
@awoodsnet@phpc.social avatar

For your shell scripts — what are you using for testing them?

publicvoit, to linux
@publicvoit@graz.social avatar

If "#!/usr/bin/env foo" is the preferred (for portable scripts) in order to find "foo" independent of its path, why isn't the recommended shebang "#!env foo" which would not assume a path for "env" either? 🤔

awoodsnet, to Bash
@awoodsnet@phpc.social avatar

what do you wish was easier about Bash scripting?

RL_Dane, (edited ) to random
@RL_Dane@fosstodon.org avatar

Hey -y peeps (),

Is there a script somewhere (Perl, preferably, or Python, or even a compiled program) that performs
blah |sort |uniq -c |sort -n
in an efficient manner using a dictionary?
Because sorting everything just to get a count with uniq -c seems very slow and wasteful.

SOLUTION, thanks to JdeBP@tty0.social:
awk '{x[$0]++;} END {for(k in x) {print x[k],k;}}'

JdeBP,
@JdeBP@tty0.social avatar

@RL_Dane

The traditional better method than sort|uniq is of course

awk '!x[$0]++'

which everyone doing text processing should learn.

So starting from that you can easily arrive at

awk '{x[$0]++;} END {for(k in x) {print x[k],k;}}'

whose output you just need to sort.

starbreaker, to random

I wanted to create a "jukebox" page for my where I list albums in my collection.

I could just write in but if the page gets big enough it'll be a pain.

Besides, I'm a techie by trade, I can automate this. I figure I'll use a and a that looks for two files:

"${BAND}.tsv": tab separated, 2 fields: band name, band description
"${BAND}.psv" pipe separated, 4 fields: year, album, label, MusicBrainz link

Then I can update my .

testing my "jukebox.sh" shell script in a terminal window. It prints Markdown text to standard output and appears to work.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • provamag3
  • InstantRegret
  • magazineikmin
  • osvaldo12
  • tester
  • Youngstown
  • rosin
  • khanakhh
  • slotface
  • ngwrru68w68
  • everett
  • thenastyranch
  • kavyap
  • DreamBathrooms
  • JUstTest
  • tacticalgear
  • ethstaker
  • anitta
  • cubers
  • Durango
  • GTA5RPClips
  • modclub
  • mdbf
  • normalnudes
  • megavids
  • cisconetworking
  • Leos
  • lostlight
  • All magazines