I was wondering if anyone here has some bright ideas on how to (tempurary) change a shell from within a Perl script without the script actually "end"! I mean, say I do "system ("bash");", the script won't continue until I do "exit" in that newly opened bash shell. Is it even possible?Indeed this is what system should do in the first place. Did you try it? Or do you want to do something different?
[blazar@zion blazar]$ perl -le 'print 1; system "bash"; print 2' 1 [blazar@zion blazar]$ whoami blazar [blazar@zion blazar]$ exit 2 [blazar@zion blazar]$
Ah, yea, and how to figure out _what_ shell I'm currently in?Well, it depends on what you mean exactly with "shell I'm currently in". If the perl script is launched from a shell, and thus is a child of it, then it can check the cmdline of the parent process. Is this what that you want?
In reply to Re: Change shell within Perl
by blazar
in thread Change shell within Perl
by Ace128
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |