I have kotlin script (but it can be any Linux command with arguments) for example:
#!/usr/bin/env kotlinc -scriptprintln("hello world")
When I run it in Ubuntu I get:
/usr/bin/env: ‘kotlinc -script’: No such file or directory
but when I run in command line:
/usr/bin/env kotlinc -script
It works. It is no problem with finding path because script:
#!/usr/bin/env kotlincprintln("hello world")
works
For some reason under Ubuntu "#!/usr/bin/env kotlinc -script"
treats "kotlinc -script"
as single argument. But only in shell script header.
I need explicitly to run my script "#!/usr/bin/env kotlinc -script"
because I want it to run properly on other distributions end environments where "kotlin"
is in $PATH
.
Is there a bug in Ubuntu coreutils or sth? Is there a way to fix it?