Re: How does bash interpret tilde character?
On 2025-08-10 08:00:15 -0400, The Wanderer wrote:
> On 2025-08-10 at 07:51, Richard Owlett wrote:
>
> > About 5 years ago the response I got was:
> >
> >> Use the 'history' command, or 'cat ~/.bash_history'.
> >
> > I have two questions:
> > 1. in context, what does " ~/ " mean?
>
> In the typical context and usage, "~/" can AFAIK be treated as exactly
> equivalent to "$HOME/".
If you mean with the quotes:
vinc17@qaa:~$ echo "$HOME/"
/home/vinc17/
vinc17@qaa:~$ echo "~/"
~/
And without the quotes, $HOME is not recommended, in case the
home directory contains spaces.
AFAIK, ~/ (without quotes) is equivalent to "$HOME/" (with quotes).
--
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Pascaline project (LIP, ENS-Lyon)
Reply to: