I've probably tooted about this before, but I don't know why this isn't standard.
It's just so obvious, at least to me. ;)
~ $ type mcd
mcd is a function
mcd ()
{
[[ -n $1 ]] && mkdir "$1" && cd "$1"
}
I've probably tooted about this before, but I don't know why this isn't standard.
It's just so obvious, at least to me. ;)
~ $ type mcd
mcd is a function
mcd ()
{
[[ -n $1 ]] && mkdir "$1" && cd "$1"
}
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 #shell #UnixShell #POSIX #PosixShell #ShellScripting
🛠️ 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: https://zbmed.github.io/2025-05-12-Software_Carpentry_ZB_MED/
#SoftwareCarpentry #OpenScience #ResearchTools #CodingForResearchers
@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).
Invitation: Next Library Carpentry Workshop takes place online on January 20 to 24 together with #EMBL. Information and registration: https://zbmed.github.io/2025-01-20-LC_EMBL-online/
#SQL #UnixShell #Python #LibraryCarpentry
@thecarpentries
In a #bash alias:
do something
printf "[ctrl-v] [up-arrow] [ctrl-v] [up-arrow] [ctrl-v] [up-arrow]"
echo something
Whoa, that actually worked?!?
I just got the most retro #Commodore64 feeling from bash of all things. XD
My master's thesis "Understanding the role of Unix shell in software development and developer experience" is now available online!
Explore how developers use the shell, their emotions towards it, and its impact on developer experience.
$ cat > file <<EOF
your file
content goes
here
EOF
Más de 10 años viviendo es esto y aún se me olvida como escribir ficheros en Unix sin recurrir a editores de texto ¬¬
🚀 Neues Video ist live! 🐚 Entdecke die #UnixShell mit meinem interaktiven Screencast. Von der Installation bis zum Shell-Skript – alles dabei! 🌟 Die #LibraryCarpentry Lesson online zum Mitmachen💡💻 https://youtu.be/L3JRQC_tZ4E?si=lZlkHW9hkyUPVKzk
Don't tell anyone, but if one escapes the ? metacharacter and *does* pass -? to my tools, it actually *is* a shorthand for --help.
"Master The Command Line With Useful Bash Aliases In Linux And Unix" says the headline.
Not much use to me.
I mainly use the Z and Korn shells, nowadays; with the occasional Watanabe.
@Migueldeicaza @mholt @film_girl
I should have kept track of whoever it was commenting the other week about how many machine instructions and conversions to and from machine-readable form it takes to increment a variable by 1.
_math() {
_m_opts="$@"
printf "%s" "$(($_m_opts))"
}
...
_request_retry_times=$(_math "$_request_retry_times" + 1)
hier(7) on #FreeBSD et al. suggests /usr/local/libexec/${YOURAPP} .
The logical extension to the XDG Base Directory Specification would likewise be ${HOME}/.local/libexec .
Of course the . command follows $path , which won't include either of those.
@Silversnapples @philheppenstall @Swebb63
I understand what Phil was saying, and this is exactly why I have the @JdeBP account.
For the benefit of MastodonApp.UK I can offer this translation from the jargon of Hippie-Unix:
Phil was clearly stoned in the 1990s.
'Peace and Love and vi key bindings, baby! "set -o emacs" is just what The Man wants you to type, man!"
(-:
Today I embraced my scatter-brained behaviour and added `alias :e="vim";` to my shell config. #vim #unixshell
@jamesbeston Whatever happened to just plain 'cat birthday.txt'? (-:
This morning's #LibraryCarpentry workshop is about #UNIXShell I am grepping hard...
A wild #blog post appears!
I do some benchmarking of #oksh with nine C compilers on #OpenBSD. Nothing conclusive is discovered, but it is nonetheless a very fun journey.
https://briancallahan.net/blog/20211010.html
#Unix #Linux #FreeBSD #NetBSD #DragonFlyBSD #BSD #C #compile #compiler #compilers #shell #unixshell #kornshell #ksh
I've released oksh-7.0 for all your shell needs.
#OpenBSD #FreeBSD #oksh #NetBSD #DragonFlyBSD #Unix #Linux #shell #ksh #KornShell #UnixShell