1

I am trying to access a native file using the ⎕NGET system function on a Ubuntu Unix system.

This works fine as long as the path/filename string does not contain blanks. If the path contains blanks the file is not recognized.

What can I do to make it work?

Adám
  • 6,573
  • 20
  • 37
  • ⎕SH'echo hello world >my\ file.txt' ⎕←⊃⎕NGET'my file.txt' hello world this works fine, however: ⎕SH 'echo hello world > /home/adrian/.wine/drive_c/users/adrian/Application\ Data/Suuntolink/test.txt' ⎕←⊃⎕NGET'/home/adrian/.wine/drive_c/users/adrian/Application\ Data/Suuntolink/test.txt' FILE NAME ERROR: /home/adrian/.wine/drive_c/users/adrian/Application\ Data/Suunt olink/test.txt: Unable to open file ("No such file or directory") ⎕←⊃⎕NGET'/home/adrian/.wine/drive_c/users/adrian/Application\ Data/Suunto link/test.txt' ∧what is going on – Adrian Zweig Nov 30 '22 at 09:15
  • That's exactly the same situation; do not escape spaces in the argument to `⎕NGET`. You kept ``\`` in `Application\ Data` (and also inserted a space in `Suunto link`). – Adám Nov 30 '22 at 11:31

1 Answers1

1

I'm not sure what exactly goes wrong, but note that spaces should not be escaped in the argument to ⎕NGET:

      ⎕SH'echo hello world > my\ file.txt'
      ⎕←⊃⎕NGET'my file.txt'
hello world

Try it online!

Adám
  • 6,573
  • 20
  • 37
  • Adam, many thanks. Problem solved. I had to take out quotes from the text string that I saved as a variable for the native file name. – Adrian Zweig Dec 01 '22 at 10:17