Hi everyone,

Ps I'm new to Perl (but have been working on Unix for a while) and I'm trying to develop my skills by taking on a project . I am trying to create a perl script that when executed behaves like a Unix Shell, but I need help on how to capture user inputs and then run them as commands at the prompt.

For example , when the perl script is run and the user types ls ., I want to capture the ls, store it in a variable...say $input , and then run the ls command so that all files listed in the current working directory are listed.

Kindly explain how to go about this to me as this is the foundation of the larger picture that I have in mind.

Thanks in advance.

NB. If you know any online resource that will help in this work, kindly let me know.

10 Years
Discussion Span
Last Post by Comatose

while ($uinput ne "quit") {
        print "# "; $uinput = <>;


        if ($uinput eq "ls") {
                open(LS, "ls -AF1 |");
                        while (<LS>) {
                                push @flist, $_;

                foreach $file (@flist) {
                        print "$file\n";
Votes + Comments
great ! This post has given me a valuable piece of information that I've been trying to get ...Thanks a lot
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.