OK, my most recent school project involved writing our own limited shell.
I've basically coded everything except the |,<, and > operators.
These are a bitch, because I hate dealing with pipes that refuse to be bi-directional. I think the solution has something to do with something called "dup"ing, though I haven't a clue how.
To explain more specifically, say I'm trying to code the "<" operator...I have to get something like
wc < sometext
to output the right thing, but I can't use the "<" opeartor in my code itself. Thus here's my attempt so far:
open (PIPE,"| $path/$command >&RESULT");
print PIPE @data;
close(PIPE);
@result = <RESULT>;
This is course doesn't work at all, but maybe it gives u an idea of what I need. I have to be able to pass @data (like sometext) in a given command (like wc) and capture the result in an array (@result). I've tried soooooo many different things and keep failing. I am at your mercy :)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.