The problem is simple:
echo ".tables" | sqlite3 $myPathVariable
If I do: PATH=/my_path
it works but i I do myPathVariable="my_path"
it fails.
The path is retrieved after getting the result of a grep+sed command like myPathVariable=`... grep ... sed`
I need to retrieve dynamically the myPathVariable at execution time, can you please help me to achieve that, I must be missing something basic!
By the way: echo ".tables" | sqlite3 my_path
works but
echo ".tables" | sqlite3 "my_path"
Edit: the variable PATH was just a bad name here, it doesn t refer to the PATH env variable, sorry :) .
Then I noticed that the problem lies within sqlite3:
The command .open ~/myDatabaseFilePath
fails.
The command .open "~/myDatabaseFilePath"
fails.
The command .open "/.../myDatabaseFilePath"
fails.
But the command .open /.../myDatabaseFilePath
works.
So sqlite3 can't deal with path containing '~' or surrounded by quotes!
The path generated at execution is correct, the file exists. It's just a workarround but it doesn't explain why it doesn't work!
I'm just curious to know why the behaviour is not the same ?
Thanks for your help!