frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

mkcd: The missing shell shortcut

https://dbohdan.com/mkcd
4•networked•7h ago

Comments

DemocracyFTW2•4h ago
> Where does mkcd come from? Multiple discovery is likely because the core idea is so simple.

Indeed, I have my own `mkcd` implementation:

    mkcd () {
      mkdir -p $@ && cd ${@:$#}
    }
Curiously I can't find where I (?) implemented it, and reading the source I realize how bash scripting is both ingenious and terrifying at the same time. I have so many questions. Where is this source recorded, what incantation tell me that? Are missing quotes around `$@` OK? I know / think / believe / heard someone say it's a modern replacement for `$*` and that one did need quotes? What is the `${@:$#}` part doing? Is it worth to save all of 7 (seven!1!) bytes so people can be so much faster by not having to type for example

    mkcd ( path ) {
      mkdir -p $path && cd $path
    }
Why is bash such a mess?

Edit: shellcheck tells me to write `"$@"` and `"${@:$#}"` so quotes are indeed needed. Why is bash such a mess? Why?

Edit: For posterity, `type mkcd` is what I'm looking for; its output is quite helpful:

    $ mkcd is a shell function from /home/REDACTED/.oh-my-zsh/lib/functions.zsh
...where I indeed find

    # mkcd is equivalent to takedir
    function mkcd takedir() {
      mkdir -p $@ && cd ${@:$#}
    }
so obviously it's not my implementation (although I 'know' I 'invented' it at some point). The source has no quotes around `$@` although similar functions above and below this one do use quotes. However I just tried

    mkcd '/tmp/what ever spaces'   
and this worked fine.

Show HN: I added Game of Life to my Portfolio Website and it's so cool

https://kuber.studio/
1•kuberwastaken•54s ago•0 comments

You have a fake North Korean IT worker problem

https://www.theregister.com/2025/07/13/fake_it_worker_problem/
2•rntn•3m ago•0 comments

So Your Doctor Is a Do. Does That Matter?

https://www.nytimes.com/2025/07/13/well/osteopath-doctor-health.html
1•jgalt212•5m ago•1 comments

Let's Activate Net://Anchor

https://github.com/dmf-archive/Tiny-ONN
1•NetRunnerSu•5m ago•0 comments

Show HN: Sohri – Turn short stories into binge-able audio episodes

https://sohri.ai/explore
5•jrlee•8m ago•0 comments

Does Trump's Biggest Crypto Backer Exist?

https://www.thenation.com/article/archive/trump-crypto-world-liberty-financial-aqua-1-foundation/
2•srameshc•12m ago•0 comments

Gemini Rolls Out Tokenized Stocks in EU, Starting with Strategy Shares

https://www.coindesk.com/business/2025/06/27/gemini-rolls-out-tokenized-stocks-in-eu-starting-with-strategy-shares
2•PaulHoule•12m ago•0 comments

2039.js – The web framework that runs in the future (literally)

1•gaeguldev•15m ago•0 comments

Elon Musk's X investigated in France for alleged data tampering and fraud

https://apnews.com/article/x-elon-musk-france-police-data-investigation-4d3ab11f8e199de3434a8c84881d5abc
2•bundie•18m ago•0 comments

Download YouTube Video, Playlist in High Quality

https://withcodeexample.com/download-youtube-video-playlist-in-high-quality/
2•harendra21•20m ago•0 comments

Designing for Artificial Empathy

https://dinoki.ai/blog/designing-for-artificial-empathy
2•tpae•20m ago•0 comments

Surname Response Protocol – Shared Grok

https://grok.com/share/bGVnYWN5_58c54add-1989-4257-914b-a26002921c91
1•zepolud•26m ago•0 comments

You can still enable uBlock Origin in Chrome, here is how

https://www.neowin.net/guides/you-can-still-enable-ublock-origin-in-chrome-here-is-how/
1•bundie•26m ago•1 comments

Finding good bets in the lottery, and why you shouldn't take them

https://arxiv.org/abs/2507.01993
1•belter•27m ago•0 comments

Metadata Shows the FBI's 'Raw' Jeffrey Epstein Prison Video Was Likely Modified

https://www.wired.com/story/metadata-shows-the-dojs-raw-jeffrey-epstein-prison-video-was-likely-modified/
1•belter•27m ago•0 comments

SIMD in Rust: you do not need multithreading to do more than one thing at a time

https://sander.saares.eu/2024/12/31/you-do-not-need-multithreading-to-do-more-than-one-thing-at-a-time/
1•fanf2•27m ago•0 comments

The Surgeon and the Homemaker

https://www.thepublicdiscourse.com/2025/05/98005/
1•jger15•28m ago•0 comments

Generating Swagger Documentation from Source Code with ChatGPT

https://gist.github.com/atjsh/4a2a6ebd45e6d14afe712ddb7fed9241
1•letaem77•30m ago•0 comments

Show HN: I Wanted to Text My Danish Girlfriend, So I Built This Tool

https://menerdu.vercel.app/
1•lil_csom•31m ago•1 comments

Automating Oral Argument

https://adamunikowsky.substack.com/p/automating-oral-argument
2•gfortaine•33m ago•0 comments

Show HN: I hate buying shoes online so I built a service to fix that

https://www.getsize.shoes
1•monsharen•35m ago•0 comments

Micro Adventure – Space Attack (online emulator)

https://auri-microadventure.azurewebsites.net/
1•AlexeyBrin•36m ago•0 comments

Kimi-Dev-72B

https://huggingface.co/moonshotai/Kimi-Dev-72B
1•tosh•38m ago•0 comments

Adding up Feynman diagrams to make predictions about real materials

https://phys.org/news/2025-07-adding-feynman-diagrams-real-materials.html
1•rbanffy•42m ago•0 comments

The US gov is failing on vax policy. Vaccine Integrity Project is here to help

https://www.statnews.com/2025/07/03/vaccine-integrity-project-michael-osterholm-cidrap-rsv-flu-covid/
1•susiecambria•43m ago•0 comments

AI coding tools make developers slower but they think they're faster study finds

https://www.theregister.com/2025/07/11/ai_code_tools_slow_down/
18•Mgtyalx•54m ago•13 comments

Netflix Vulnerability: Dependency Confusion in Action

https://www.landh.tech/blog/20250610-netflix-vulnerability-dependency-confusion/
2•0xcybersec•1h ago•0 comments

Thunderbird: Fluent Windows 11 Design

https://github.com/Deathbyteacup/fluentbird
1•skipnup•1h ago•0 comments

Show HN: Try Free 5 SEO-Ready Articles Generated, You Make Them Unique

https://writfy.ai
1•wrtify_ai•1h ago•2 comments

Drones Are Key to Winning Wars Now. The U.S. Makes Hardly Any

https://www.nytimes.com/2025/07/13/business/drones-us-military-manufacturing-lags.html
33•perihelions•1h ago•36 comments