Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Yes, most things you can call will expect path that has been run through that idiom. When you use paths like that in the shell (eg, when you do something like <code>cat ~raxacoricofallapatorius/foo.txt</code>), it is <em>the shell itself</em> - rather than <code>cat</code> or any other program you might run - that does the path normalisation. </p> <p>You can verify this trivially - eg,</p> <pre><code>lvc@tiamat:~/Projects$ echo ~ /home/lvc </code></pre> <p>So this does mean that if you expect to get a path with those kinds of variables as input, you will need to do the preprocessing yourself. The alternative is to run the commands through a shell, and be ready to deal with all the problems <em>that</em> brings.</p> <p>However, at least on unix-like systems (Windows may or may not behave the same way), you <em>don't</em> need to do this for <code>.</code> and <code>..</code> - these are understood by the system calls, and the shell does not transform them - so, eg:</p> <pre><code>lvc@tiamat:~/Projects$ file .. ..: directory lvc@tiamat:~/Projects$ file ~ /home/lvc: directory </code></pre> <p>Notice that <code>file</code> sees <code>..</code> unchanged, but sees the expanded form of <code>~</code>.</p> <p>This means that if all you want is paths that will work directly in external programs, passing it through <code>expanduser</code> and possibly <code>expandvars</code> is sufficient. You will want to call <code>abspath</code> primarily if the program you are calling out to will run in a different working directory than yours.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload