mastouille.fr est l'un des nombreux serveurs Mastodon indépendants que vous pouvez utiliser pour participer au fédiverse.
Mastouille est une instance Mastodon durable, ouverte, et hébergée en France.

Administré par :

Statistiques du serveur :

639
comptes actifs

#unixshell

0 message0 participant0 message aujourd’hui

I experimented with not having persistent shell history, after @simontatham blogged about it.

Good:
- higher threshold for writing long complicated commands
- lower threshold for writing shell scripts instead

Bad:
- writing shell scripts

I've since started experimenting with the Fish shell, and it brings a whole different level to the shell history game. So far I like it.

#UnixShell#shell#bash

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

🛠️ Curious how coding can support your research?
Join our Software Carpentry Workshop for absolute beginners – no experience needed, just curiosity and motivation!

📅 May 12–13, 2025, 09:00–16:00
📍 ZB MED, Cologne
👩‍💻 Hands-on sessions on:
#UnixShell
#Git for version control
#Python programming

👩‍🏫 With @RabeaMue, Silvia Di Giorgio & Justine Vandendorpe
🔗 Register: zbmed.github.io/2025-05-12-Sof

@jeeynet Salut, merci pour l'idée, je ne savais pas que c'était possible ! Concernant le script proposé, ce test est bizarre  :

if [ "${1}" ]

Si "${1}" venait à coïncider avec un opérateur de test(1) , vous auriez des surprises. Je suggère ceci à la place :

if [[ $# -gt 0 ]]

ou bien

if [[ -n "$1" ]]

Notes :

  • on peut se permettre [[ … ]] car le script utilise Bash;

  • vous pouvez enlever les " autour de $1 dans cet exemple mais attention, c'est un cas bien particulier dû au fait que [[ … ]] ne fait pas de “word splitting” sur l'expression fournie).