SQLite Forum

sqlite3 .shell - conditional executions with `[[ expr ]]` constructs
> I am not clear how to apply [your suggestion] in my situation.

That's because you're presenting us with an [XY problem][1], telling us how your actual problem must be solved, then telling us about the problems you've run into trying to solve the actual problem with that method. Instead, tell us *precisely what end goal you're trying to accomplish*, so we can suggest ways of tackling that *entirely separate problem.*

Your actual use case isn't to solve the Dash vs Bash problem, nor to sort out `test(1)` vs double-bracket expression limitations, nor to fight with the conflicting punctuation and whitespace escaping rules of the SQLite shell vs that of POSIX shells. Tell us about this document processing problem, not about your increasingly convoluted attempts to solve the shell scripting problem.

I *suspect* that what you actually need is a GNU Makefile or a shell script iterating over the contents of a [Fossil manifest file][2], but until I get those details, those are just guesses based on vague data.

I'd attempt to invert your latest example, but it doesn't even have any SQL statements or Fossil commands in it. I mean, I could write a shell script that itself wrote and executed another shell script, as your above code does, but I'm not seeing the point of doing the work.

Let's pop a few levels of indirection and get concrete, okay?

[1]: https://xyproblem.info/
[2]: https://fossil-scm.org/home/help?cmd=manifest