I've been a professional C, Perl, PHP and Python developer.
I'm an ex-sysadmin from the late 20th century.
These days I do more Javascript and CSS and whatnot, and promote UX and accessibility.
We use ~ symbol to indicate that the path is relative.
That's not quite right. The path ~/foo/bar is an absolute one, your shell is expanding ~ to your home directory on the fly.
A relative path is one relative to your current working directory. So if you're in /home/user and you say cd /tmp you'll end up in /tmp (absolute) but if you say cd tmp without the root, you'll end up in home/user/tmp, assuming it exists.
You can tell that paths starting with '~' are absolute because it doesn't matter where you are when you use them.
That's not quite right. The path
~/foo/bar
is an absolute one, your shell is expanding~
to your home directory on the fly.A relative path is one relative to your current working directory. So if you're in
/home/user
and you saycd /tmp
you'll end up in/tmp
(absolute) but if you saycd tmp
without the root, you'll end up inhome/user/tmp
, assuming it exists.You can tell that paths starting with '~' are absolute because it doesn't matter where you are when you use them.
Got it ! Thanks for pointing out.