Using sql lite in a path with a folder name with a space

Hi all,

I’m trying to install sql lite from BASH and I got all the way to step of creating an alias and then trying to spin up a test db. It failed because of a space in a folder name in the path. Here’s a link to the article I’m on.

The path should be: /c/Users/Josh Newland/downloads/sqlite-tools-win32-x86-3300100

But when I try to run the alias variable, I get the error message: “winpty: error: cannot start ‘/c/users/Josh’: No such file or directory”

Note that it drops the rest of the directory after the space in my name “Josh Newland”.

I saw some forums saying to put a \ right before the space… but that didn’t seem to work for me.

Anything to be done here aside from rename my folders to not have spaces?

Try using %20 in place of the space in the path name.

1 Like

it drops the rest

who/what is it though?

Arguably it’s you, right, because you supplied two arguments instead of one

If you are entering that command in bash, then, yes, a backslash does make bash treat it like a literal space character as opposed to a delimiter for the arguments, and if that didn’t do it then I start wondering what you entered and what “seems” means, maybe it even succeeded.

%20 will not help you, because those are perfectly valid characters on their own, nothing special happens with that.

quoting your argument will also treat it as a single argument

renaming directories is not the only other option, you can just as well use a different directory, or for that matter change your current directory to that directory

There’s also a whole lot of silliness of back and forth between windows and a more unix-like environment going on there, normal usage looks like so:

$ sqlite3 mydatabasefile

since you’re passing those arguments to some program named winpty, it is possible that it doesn’t deal correctly with spaces. if that’s the case, and I’m not saying it is, then the path of least resistance would be to use directories without spaces in them, though the real solution is to use fewer odd workarounds and eliminate the things being worked around

if you’re going to use an sqlite executable compiled for windows then you might want to use a terminal application for windows too, like powershell, or install sqlite3 in whatever environment you’re using bash in

you could also use a virtual machine and run linux to avoid having to deal with workarounds in windows which are more difficult than the task itself

Definitely a good first step.

Thanks guys, I wound up just moving it to a folder right on the C:/ drive to avoid spaces for now. I’ll probably get into Powershell and more windows based stuff soon, it’s just that the Code Academy course uses Bash, so I’ll stick with that through the course.

I got it all working though, and improved my knowledge of what was happening in the command line as well by having to deviate from the code academy instructions a bit.

1 Like

There’s not much reason to learn powershell unless you’re going into microsoft specific stuff (which is questionable unless getting paid for it)

But if you have a windows executable then run it in windows. Better yet, get an executable that runs in your environment.

If you pile up various tools from multiple environments none of which you know, then it’ll either magically work and you won’t know why, or it won’t and there are so many parts from different places that there’s no hope of figuring it out.

This topic was automatically closed 18 hours after the last reply. New replies are no longer allowed.