LISP: Problem with vl-filename-mktemp prefix

Does anybody know why the default prefix "$VL" used by (vl-filename-mktemp) gets stripped from the file name in this case?:
[code]: (setq name (vl-filename-mktemp))
"/home/roy/$VL~~00a"
: (command "_.shell" (strcat "ls > " name))[/code]
The result is this file:
/home/roy/~~00a

The problem can be avoided by using something like:
(vl-filename-mktemp "abc")

Note: The code below works without any problems. So the prefix "$VL" is allowed on LInux.
[code](defun C:Temp_file ( / file)
  (setq file (vl-filename-mktemp))
  (setq file (open file "w"))
  (write-line "test" file)
  (close file)
)[/code]

Comments

  • Roy,
    The $ sign is a reserved char in the shell, and it is not enough to put it into quotes to prevent it from getting interpreted. From the bash man page:

    ... The characters $ and ` retain their special meaning within double quotes. ...

    So you have to escape it with a leading backslash (\$) to use it in file names etc.
  • Thanks for clearing that up Knut. I guess I am still a novice when it comes to Linux.
  • Dear Roy, Dear Knut,

    thanks for sharing !
    So it seems a good idea to refactor (vl-filename-mktemp) fucntion, not to use that "$VL" prefix,
    but to use a slightly different one, not using such special characters.

    I will implement, and one of next BricsCAD versions should have it.

    Many greetings !
This discussion has been closed.