ehmicky, to programming
@ehmicky@fosstodon.org avatar

We just released Execa 9, which is our biggest release so far.

If you're currently using Execa, you should check out the new features! Also, if you're currently using zx or Bun shell, you might be interesting in this alternative.

https://medium.com/@ehmicky/execa-9-release-d0d5daaa097f

governa, to Bash
@governa@fosstodon.org avatar

How to Add Comments in Scripts

https://www.tecmint.com/bash-script-comments/

ebel, to Bash
@ebel@moytura.org avatar

Any good cli/terminal spell checking programmes? Pass in a file, get an terminal interactive “replace this with that / ignore / add to dict.” workflow.

I remember using aspell(1) back in Ye Olden Days. Is that still the best?

:boost_ok:

felix, to Bash French
@felix@mamot.fr avatar
linuxmagazine, to linux
@linuxmagazine@fosstodon.org avatar
ChristosArgyrop, to Bash
@ChristosArgyrop@mstdn.science avatar

This made my night

image/jpeg

travisfw, (edited ) to Bash
@travisfw@fosstodon.org avatar

a little script to create a bookmark in the

$ cat ~/bin/bookmarkhtml.bash   
#!/bin/bash

HELP="usage: $0 FILENAME URL"  
[ -n "$1" -a -n "$2" ] || { echo "$HELP" >&2; exit 1; }  
FILENAME="$1"  
URL="$2"  
if ! [[ $FILENAME =~ \.html$ ]]  
then FILENAME="$FILENAME.bookmark.html"  
fi

>$FILENAME cat <<EOHTML  
<html><head>  
<meta http-equiv="refresh" content="0; url=$URL" />  
</head><body>  
<p><a href="$URL">$URL</a></p>  
</body></html>  
EOHTML  

now just open that bookmark.html file.

vwbusguy, (edited ) to random
@vwbusguy@mastodon.online avatar

Doing datetime evals in always makes me a bit sad that 's built in datetime is so janky.

vwbusguy,
@vwbusguy@mastodon.online avatar

Getting epoch time from exactly six months ago from now is a simple one liner in due to date from coreutils. No pipes, etc, necessary.

date -d"6 months ago" '+%s'

But you can also use printf builtin with bash if you need something more verbose or want to assign a datetime variable directly.

knu,
@knu@toot.community avatar

@vwbusguy
Suggestion:
import sqlite3 and use the SQLite date/time functions. No database required. It will be faster than shelling out to bash al the time.

https://www.sqlite.org/lang_datefunc.html

dcz, to Bash
@dcz@fosstodon.org avatar

#shell #trick with which I surprised greybeards at the local hackerspace (which was surprising cause I'm the opposite of a #bash expert):

mv photo{tocheck,supercool}.jpg

is the same as

mv phototocheck.jpg photosupercool.jpg

The shell copies an argument with {,} inside, and each resulting argument has a different part of what's in {}.

rm plan.{md,svg,png,odt}

Have fun!

#linux #unix #sh #tip

nemobis,
@nemobis@mamot.fr avatar

@dcz Oh damn. I use brace expansion in my commit messages all the time. I sure hope they've not been as cryptic for my colleagues all along.

vwbusguy, to random
@vwbusguy@mastodon.online avatar

I asked ChatGPT and another AI to generate qbsh scripts and even gave it commands like CALC and PIP to incorporate. It clearly had bash in the crunchbang. When I suggested it wasn't qbsh, it apologized, removed that line and told me it was more using correct syntax and not "bash built-ins" and hallucinated qbsh commands that don't exist like GREP. It was pretty hilarious.

vwbusguy,
@vwbusguy@mastodon.online avatar

Close to none of this is true whatsoever. It was partly inspired by , but also by CP/M. And while does support basic scripting, it is very much not BASIC compatible with any retro BASIC platform.

qbsh won't teach you to program in by using it, even though it is and written in QBASIC, but to that end, qbsh won't teach you how to code in BASIC any more than will teach you to code in C.

necrosis, to science German
@necrosis@chaos.social avatar

Leute. Ich hab sooooooooooo was geiles entdeckt.

Kennt ihr schon https://www.olivetin.app/ ?

Damit kann man Tools eine verpassen. 😍

Ok, das würde sich auch mit von umsetzen lassen. Aber dennoch.

Für unsere Beschäftigten, die eher Windows gewohnt sind kann ich so Shell Tools leichter zugänglich machen. Das ist so toll. 😍

Für sicher auch einen Blick wert. :3


brennansv, to Bash
@brennansv@sfba.social avatar

There is a Bash IDE extension for VS Code which works with LSP to support shell scripting. I have IDE features for shell scripts now. 🤯 https://marketplace.visualstudio.com/items?itemName=mads-hartmann.bash-ide-vscode

Tealk, to Bash German
@Tealk@rollenspiel.social avatar

I noticed a problem in my script, if the newest account that was notified is a SpamBot and I delete it, countless old accounts are notified again.

Any ideas on how to solve this problem?

https://codeberg.org/RollenspielMonster/simple-toot

juandesant, (edited ) to random
@juandesant@astrodon.social avatar

A one-liner for exporting your Conda environments for re-creation on another machine… but you might want to have a look at whether you actually need to recreate those environments.

for envs in $(conda env list | egrep -v "^#" | awk '{print $1}'); do echo "Exporting environment: $envs"; conda activate $envs; conda env export --no-builds | egrep -v "^prefix" > "$envs.yaml"; conda deactivate $envs; done; ls -l *.yaml  

/ht @boitarsor for improvement

unicornCoder, to Bash
@unicornCoder@fosstodon.org avatar

i LOVE ❤️ BASH !!

it was the best solution to extract text from 1593 files.

RL_Dane,
@RL_Dane@fosstodon.org avatar

@unicornCoder

This kind of thing is what has kept me dinking around with for over 20 years.

It's not the fastest language
It's not the prettiest language
It's not the most flexible language.

But dang if I can't just sit there and blurt code out onto the screen that does amazing things. :D

wtfrank, to microsoft
@wtfrank@mastodon.social avatar

We certainly kissed the DOS prompt goodbye... but we installed Linux and used POSIX shells instead...

chmouel, to Bash
@chmouel@fosstodon.org avatar

reading the tzselect shell script from the tzdata, there is a nice flag called -c to specify coordinates, the way the script does gps coordinates to timezones in awk is pretty impressive!

so if you travel a lot and have no idea where you are located and want to set your timezone quite easily you can do something like this to approximately know where you are (it's useless i know, just interesting):

tzselect -c $(curl -s ipinfo.io|jq -r .loc| tr , -)

DrHyde, to Bash
@DrHyde@fosstodon.org avatar

WTF ?!?!?!

$ PI=3.14
$ echo $PI
3.14
$ SECONDS=3.4
-bash: 3.4: syntax error: invalid arithmetic operator (error token is ".4")

slink, to Bash
@slink@fosstodon.org avatar

Oh noooo, I just realized that obviously the original hackers wiki is offline (used to be under bash-hackers.org). But apparently flokoe *) made an effort to revive it: https://github.com/flokoe/bash-hackers-wiki
If you ever read this, thank you!

*) I could not find them on mastodon, there are accounts by the same name, but look unrelated

boilingsteam, to linux
@boilingsteam@mastodon.cloud avatar
axelhahn, to foss
@axelhahn@fosstodon.org avatar

Cronjobs are quite basic stuff. Mostly you create “simple, stupid” jobs without output … that just run. Or should.

How do you check if a job was successful? Just trust them? Watching each log? On each of your systems?

How do you detect if the last job execution was successful but does not run anymore?

My simple approach:

For 20 years I add a wrapper in front of my commands.

Docs: https://www.axel-hahn.de/docs/cronwrapper/index.html

Source: https://github.com/axelhahn/cronwrapper

cronstatus.sh shows the status of all local cronjobs or details of a single cronjob.

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