in reply to Running a command from a text file

You can execute a shell-script as if it were any other system command ... but I would caution you to be very careful with this.   Generally speaking, when I am reading a piece of source-code to understand how it works, I do not want to have to branch-off to read another source-file, especially not one that is written in a totally different language and especially not one that in effect steps-away from the Perl context completely to do whatever it does.   If this file contains a single line, I’d rather see that single-line within the Perl source.   And I must say that I am not too keen on “one-liners” much either, because brevity sacrifices clarity.   These practices are much less maintainable than other alternative choices for doing the same things, and I would strongly encourage you to champion maintainability as much as it makes sense in your work.

Replies are listed 'Best First'.
Re^2: Running a command from a text file
by pvaldes (Chaplain) on May 21, 2014 at 19:26 UTC

    because brevity sacrifices clarity

    Well... One of the most popular reasons to do overcomplicated things like this is to hide your command in bash, thus clarity probably is not the main goal here

    Just think before to do what you want to do, that there is always a bigger dog than oneself even if you try to cover your own traces. Read about the special bash variable $0

    perl -e 'system("\$0 < mybashscript.sh");'

    You should better try to traduce your script to perl code instead if you want to call it from perl