Perl has had a similar trick for quite a while:
eval 'exec /usr/bin/perl -w -S $0 ${1+"$@"}'
if 0; # not running under some shell
See https://stackoverflow.com/questions/9143726/what-means-not-r...