kreon3 has asked for the wisdom of the Perl Monks concerning the following question:
I am writing a script that uses the aliases of the current ksh shell and processes them. I am running into an issue where any execution (system, ``, open piping) of the "alias" command creates a new shell instance and does not gather my current aliases. I have tried a variety of approaches so far from the simple ways:
my $alias_str = `alias`;To even complex methods:
system "echo \"alias > aliases.tmp\" > get_aliases.ksh"; chmod (0777, 'get_aliases.ksh'); system '. get_aliases.ksh'; open (ALIASES, "aliases.tmp"); foreach my $line (<ALIASES>){ print "alias line $line\n"; }
Nothing appears to be working because perl or ksh creates a new shell instance preventing gathering of the current shell's aliases.
Anyone have any ideas on how to pull the ksh aliases into perl? Thanks.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Gathering current ksh shell aliases in perl
by ikegami (Patriarch) on Apr 26, 2010 at 21:15 UTC | |
Re: Gathering current ksh shell aliases in perl
by JavaFan (Canon) on Apr 26, 2010 at 21:49 UTC | |
by pobocks (Chaplain) on Apr 27, 2010 at 03:30 UTC | |
by JavaFan (Canon) on Apr 27, 2010 at 07:48 UTC | |
Re: Gathering current ksh shell aliases in perl
by cdarke (Prior) on Apr 27, 2010 at 11:31 UTC | |
by afoken (Chancellor) on Apr 28, 2010 at 06:26 UTC | |
Re: Gathering current ksh shell aliases in perl
by samarzone (Pilgrim) on Apr 27, 2010 at 07:56 UTC | |
Re: Gathering current ksh shell aliases in perl
by LanX (Saint) on Apr 28, 2010 at 07:55 UTC |