stephenmw opened a new issue, #11880:
URL: https://github.com/apache/datafusion/issues/11880
### Is your feature request related to a problem or challenge?
I would like to create executable scripts using datafusion-cli as an
interpreter.
For example, given the following tmp.sql file:
```
#!/usr/bin/env -S datafusion-cli -f
SELECT 1;
```
I would like to be able to run the following successfully:
```
$ chmod 755 tmp.sql
$ ./tmp.sql
```
Instead, I get this:
```
$ chmod 755 tmp.sql
$ ./tmp.sql
DataFusion CLI v40.0.0
SQL error: ParserError("Expected an SQL statement, found: #!")
$
```
### Describe the solution you'd like
When datafusion-cli is run on a file it should ignore the first line of the
file if it begins with '#!' as the first two characters.
I believe no valid SQL file can begin with '#!'. Therefore it is safe to
make this rule. If for some reason someone wanted to begin a statement with #!,
they can put a return at the beginning of the file. '#!' must be the first two
characters of the file to be a valid hashbang.
### Describe alternatives you've considered
_No response_
### Additional context
https://en.wikipedia.org/wiki/Shebang_(Unix)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]