Why does perl excute bash script ?

Solution Verified - Updated -

Issue

  • perl can interpret bash syntax and can execute bash script if the script begins with #! directive, e.g.
# cat /tmp/perl.shell.sh
#!/bin/bash
set -x
echo "this is test of perl"
# perl /tmp/perl.shell.sh
+ echo 'this is test of perl'
this is test of perl
#
  • Why perl does not throw error message ?

Environment

  • Red Hat Enterprise Linux (RHEL) all versions
  • perl

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.