[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How does bash interpret tilde character?



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/".

>     2. what reference would answer a similar question?

There are probably plenty of places online which would explain it, but
the canonical place AFAIK is the bash man page. There is a specific
section entitled "Tilde Expansion".

Reading that section shows that actual processing is more complicated,
but AFAIK I have never encountered any instance in which it would lead
the result to be inconsistent with the equivalency to $HOME.

-- 
   The Wanderer

The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man.         -- George Bernard Shaw

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: