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, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content