Re: how to expand ~ in a filepath

Viktor Dukhovni <[email protected]> Thu, 24 Jul 2025 15:53:11 +1000
Newsgroups gmane.comp.lang.haskell.cafe
Message-ID <[email protected]>
On Tue, Jul 22, 2025 at 02:23:04PM +0200, Hécate via Haskell-Cafe wrote:

> With GNU bash, version 5.2.37(1)-release, `~foo` (provided that foo is a
> user) is indeed expanded to the user's home directory.

Ditto in "zsh" (largely bash-compatible) on MacOS:

    % echo ~/Library
    /Users/viktor/Library

    % echo ~admin/Library
    /Users/admin/Library

And both /bin/sh and /bin/csh on NetBSD:

    $ echo ~root/.profile ~postfix/public
    /root/.profile /var/spool/postfix/public

So "~" expansion is quite common in modern Unix shells.

-- 
    Viktor.  🇺🇦 Слава Україні!
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.