techhub.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
A hub primarily for passionate technologists, but everyone is welcome

Administered by:

Server stats:

5.4K
active users

#bash

40 posts36 participants3 posts today

After having read what horrors people experienced when they upgrade their Hugo binaries, I made sure that I've kept the version that I used to make my test site & also consequently use *that* version to continue to teach myself a higher level of fluency in the markdown language

`hugo version`
hugo v0.140.2-aae02ca612a02e085c08366a9c9279f4abb39d94+extended linux/amd64 BuildDate=2024-12-30T15:01:53Z VendorInfo=gohugoio

🖋️ #bash #sh #zsh #ksh #csh #Hugo #Linux #POSIX #FOSS #100daysofCode #640DaysOfCode #1024DaysOfCode #programming

Today I found that bash uses dynamic scoping, not lexical scoping. So if you have a

function inner() {
echo "$x"
}

it will go up the call stack to find the first x defined as

local x

in any caller and print it. Pity (add more swearwords here)🙁 . There is a reason why emacs lisp is being converted to lexical scoping despite having decades of dynamic binding history.

#bash #dynamicscoping #lexicalscoping #programming #scripting

stackoverflow.com/a/48166252/2

Stack OverflowUnderstanding lexical scoping - is Wikipedia correct?I've been trying to grok lexical scoping (I'm far from convinced by the use of the word lexical but that's another discussion) and I've looked at Wikipedia's entry. According to the fairly simple ...

Finally found out how to disable that press-enter-to-complete-paste thing.

On the bash shell (and login again):
[edwin@sg-shared-oel9 ~]$ cat .inputrc
set enable-bracketed-paste off

Or in the PuTTY configuration, see image:

Continued thread

I also have a script (github.com/reillypascal/person) that takes a flag for the interaction type and a URL, extracts the title from the URL, and creates a new interaction post (e.g., like, RSVP, etc.). Makes things much more convenient than having to copy all that down by hand!

My personal site, formatted for a static site generator (Eleventy) - reillypascal/personalsite-ssg
GitHubpersonalsite-ssg/interaction at main · reillypascal/personalsite-ssgMy personal site, formatted for a static site generator (Eleventy) - reillypascal/personalsite-ssg

I added some more cool things to my grimoire! reillyspitzfaden.com/code/#gri

I have interactions on Mastodon/Bluesky coming in as webmentions, and that's nice, but other sources get lost in the shuffle, so I have a script here (github.com/reillypascal/person) that filters out all the ones where "wm-source" contains "brid.gy/," which is super helpful.

Pixel art of a radio tower and floppy disk, with pixel art text reading 'Reilly Spitzfaden'
reillyspitzfaden.comReilly Spitzfaden, Composer | Code

Покращив свій #bash промт за допомогою #chatgpt
```
PS1="
\[\033[1;37m\]┌($(if [[ ${EUID} == 0 ]]; then echo '\[\033[01;31m\]\H'; else echo '\[\033[01;34m\]\u@\h'; fi)\[\033[1;37m\])─(\$(if [[ \$? == 0 ]]; then echo \"\[\033[01;32m\]✓\"; else echo \"\[\033[01;31m\]✗\"; fi)\[\033[1;37m\])─(\[\033[1;34m\]\@ \d\[\033[1;37m\])
└─(\[\033[1;32m\]\w\[\033[1;37m\])─(\[\033[1;32m\]\$(ls -1 | wc -l | sed 's: ::g') files, \$(ls -lah | grep -m 1 total | sed 's/total //')b\[\033[1;37m\])\$( \
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then \
branch=\$(git rev-parse --abbrev-ref HEAD 2>/dev/null); \
if [[ \$branch == \"main\" || \$branch == \"master\" ]]; then \
echo '─(\[\033[1;31m\]git:'\$branch'\[\033[1;37m\])'; \
elif [[ \$branch == qa* ]]; then \
echo '─(\[\033[1;33m\]git:'\$branch'\[\033[1;37m\])'; \
elif [[ \$branch == dev* || \$branch == development ]]; then \
echo '─(\[\033[1;32m\]git:'\$branch'\[\033[1;37m\])'; \
else \
echo '─(\[\033[1;34m\]git:'\$branch'\[\033[1;37m\])'; \
fi; \
fi)\
─> \[\033[0m\]"
```

#Linux #Bash

4 JPGs zu einem zusammenfassen,
Rand rundrum dran machen und beschriften. Es ist mal wieder ein 1-Liner für #Bash und #Imagemagick

montage -strokewidth 3 -stroke black -border 2 -fill white -pointsize 40 -gravity south \( 1.jpg -annotate 0 ARD \) \( 2.jpg -annotate 0 ZDF \) \( 3.jpg -annotate 0 3SAT \) \( 4.jpg -annotate 0 ARTE \) -tile 2x2 -mode Concatenate fourpic.jpg

Should've made this a long time ago:

function ciglob {
    #case-insensitive glob generator
    echo "$*" |while read -N1 c; do
        case "$c" in
            [a-zA-Z])   echo -n "[${c^^}${c,,}]";;
            *)          echo -n "$c"
        esac
    done
}
~ $ ciglob "Hello, world!"
[Hh][Ee][Ll][Ll][Oo], [Ww][Oo][Rr][Ll][Dd]!
~ $ ls -ld $(ciglob documents)
drwxr-xr-x 52 ~~~ ~~~ 20,480 Apr 10 11:45 Documents

(Not the most useful example, but I did have a use case in mind when I wrote it ;)

P.S. (This is a valid way to close a parenthesis. Fight me ;)

#bash#ksh#sh