Everybody would like to write scripts such as: $ cat myscript.rb #!/usr/bin/scl enable ruby193 ruby puts 'hello from ruby' However, this does not work. Therefore some tries to workaround this problem using wrapper scripts, so there exits package such as ruby193-ruby-wrapper, which add some simple wrappers you can later use in shebangs. Other fails with errors such as [1]. It appears, that all these problems are due to nature, of how the shebang is interpreted. E.g. the line "#!/usr/bin/scl enable ruby193 ruby" is the same as you would execute "/usr/bin/scl 'enable ruby193 ruby'". In other words, everything behind the /usr/bin/scl is passed into the newly executed interpreter as a first argument. How this works is discussed in [2]. I believe, that simple solution would be, if scl can parse the first parameter and split it internally into the other parameters, when it detects: 1) it has only one parameter, 2) it begins with acceptable keyword 3) and this keyword is followed by white space. This IMO would completely remove the need for wrapper scripts and make scl users more happy. [1] https://access.redhat.com/site/discussions/702583 [2] http://netbsd.2816.n7.nabble.com/usr-bin-env-behaviour-td219297.html
Note that since bug 924120 you can use -- as delimiter, which can get you help rid of quotes: /usr/bin/scl enable ruby193 -- ruby But that does not solve the problem with shebang behaviour :( I would not like modification of scl itself. Because it opens question how to parse options which contains spaces: ruby -e puts\ "foo" Instead we can ship with scl-utils script called scl-shebang, which will be: #!/bin/bash ACTION = $1 COLLECTION = $2 shift 2 scl "$ACTION" "$COLLECTION" $@ And you should be then able to run #!/usr/bin/scl-shebang enable ruby193 -- ruby --some-param
(In reply to Miroslav Suchý from comment #1) > Instead we can ship with scl-utils script called scl-shebang, which will be: > #!/bin/bash > ACTION = $1 > COLLECTION = $2 > shift 2 > scl "$ACTION" "$COLLECTION" $@ > > And you should be then able to run > #!/usr/bin/scl-shebang enable ruby193 -- ruby --some-param IIUIC, the script gets only $1 set to value 'enable ruby193 -- ruby --some-param' in this example, so it should have to look differently; e.g. like the following: #!/bin/sh eval scl $@ Anyway, +1 for additional script, since making scl more complex doesn't seem like a good idea for me.
Thank you guys for your input. Definitely good idea with scl-shebang wrapper. Nevertheless, I am still slightly in favor of my original proposal for single reason - it does not need any additional documentation IMO. Using "#!/usr/bin/scl enable ruby193 ruby" shebang is naturally the first thing people will try and fail with confusing: "Need at least 3 arguments. Run scl --help to get help." So I would first try to modify the scl and if this attempt fails, I would go with something like scl-shebang. Btw I agree with Honza's commet #2 (did not tested it though ;).
Upstream ticket: https://fedorahosted.org/SoftwareCollections/ticket/13
scl-utils-2.0-2.fc20 has been submitted as an update for Fedora 20. https://admin.fedoraproject.org/updates/scl-utils-2.0-2.fc20
scl-utils-2.0-2.fc21 has been submitted as an update for Fedora 21. https://admin.fedoraproject.org/updates/scl-utils-2.0-2.fc21
Package scl-utils-2.0-2.fc21: * should fix your issue, * was pushed to the Fedora 21 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing scl-utils-2.0-2.fc21' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2015-0479/scl-utils-2.0-2.fc21 then log in and leave karma (feedback).
scl-utils-2.0.1-1.fc21 has been submitted as an update for Fedora 21. https://admin.fedoraproject.org/updates/scl-utils-2.0.1-1.fc21
scl-utils-2.0.1-1.fc20 has been submitted as an update for Fedora 20. https://admin.fedoraproject.org/updates/scl-utils-2.0.1-1.fc20
Can you please post here, what solution you choose? How this report was resolved?
This works as of scl-utils-2.0: #!/usr/bin/scl enable <collection> -- <command> If you find any problems, let us know.
scl-utils-2.0.1-2.fc20 has been pushed to the Fedora 20 stable repository. If problems still persist, please make note of it in this bug report.
scl-utils-2.0.1-2.fc21 has been pushed to the Fedora 21 stable repository. If problems still persist, please make note of it in this bug report.
Any idea when/how scl-utils-2.0.1 will be avalible for RHEL?
(In reply to iakov Gan from comment #14) > Any idea when/how scl-utils-2.0.1 will be avalible for RHEL? I would not expect it any time soon due to backward compatibility issues.