SQLite Forum

sqlite3 .shell - conditional executions with `[[ expr ]]` constructs
Login
> it is enough to let you specify that a particular shell be run if you simply name it as the first word in the arguments to .shell.

Thank you for your suggestion. I wish I know the syntax for that or a way to reliable iterate by myself to this/another solution. My attempts so far end up in vain.

```sh
sqlite> .shell /bin/bash; fin=file1.doc ; [[ "${fin##*.}" = "doc" ]] ; echo "$?\n${fin##*.}" ; echo "$fin" ;
$ exit   #<-- user typed on prompt 
exit
sh: 1: [[: not found
127
sh: 2: doc: not found
file1.doc
sqlite>

sqlite> .shell #!/bin/bash ; fin=file1.doc ; [[ "${fin##*.}" = "doc" ]] ; echo "$?\n${fin##*.}" ; echo "$fin" ;

sqlite>

sqlite> .shell #!/bin/bash fin=file1.doc ; [[ "${fin##*.}" = "doc" ]] ; echo "$?\n${fin##*.}" ; echo "$fin" ;

sqlite>
```
and many more...