in reply to system & exec
My script can not work system using source.
That's because "source" isn't a valid command in your perl's default shell. Use "." instead and it should work fine, as demonstrated below. Although, since you are shelling out there is not really any practical difference between sourcing the script with "." and just executing it (but that's a different question and is likely the X in your XY Problem)
$ cat script.sh echo Woo-hoo! $ cat yang.pl #!/usr/bin/env perl use strict; use warnings; system '. ./script.sh'; $ ./yang.pl Woo-hoo! $
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: system & exec
by ikegami (Patriarch) on Jul 28, 2018 at 19:17 UTC | |
by afoken (Chancellor) on Jul 29, 2018 at 08:00 UTC | |
by hippo (Archbishop) on Jul 28, 2018 at 19:57 UTC |