User defined pipe and redirection operators: Difference between revisions
Content added Content deleted
m (create "user defined" the equivalents of the Unix shell "<", "|", ">", "<<" and ">>" operators.) |
m (augment the sample/example shell script) |
||
Line 8: | Line 8: | ||
'''Task:''' |
'''Task:''' |
||
If the language supports operator definition, then: |
If the language supports operator definition, then: |
||
* create "user defined" the equivalents of the Unix shell "<", "|", ">", "<<" |
* create "user defined" the equivalents of the Unix shell "<", "|", ">", "<<", ">>" and $(cmd) operators. |
||
* Provide simple equivalents of: cat, tee, grep, uniq, wc, head & tail, but as procedures native to the specific language. |
* Provide simple equivalents of: cat, tee, grep, uniq, wc, head & tail, but as procedures native to the specific language. |
||
* Replicate the below sample shell script, but in the specific language. |
* Replicate the below sample shell script, but in the specific language. |
||
Line 18: | Line 18: | ||
'''Sample shell script:''' ''¢ draft - pending a better (more interesting) suggestion ¢'' |
'''Sample shell script:''' ''¢ draft - pending a better (more interesting) suggestion ¢'' |
||
<lang sh> |
<lang sh> |
||
aa="$( |
|||
⚫ | |||
( |
|||
⚫ | |||
head -4 < List_of_computer_scientists.lst; |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
); |
|||
echo "Pioneer: $aa" |
|||
</lang> |
|||
'''Input File:''' |
'''Input File:''' |
||
* List_of_computer_scientists.lst - cut from wikipedia. |
* List_of_computer_scientists.lst - cut from wikipedia. |
||
Line 28: | Line 33: | ||
'''Output:''' |
'''Output:''' |
||
<pre> |
<pre> |
||
Adriaan van Wijngaarden - Dutch pioneer; ARRA, ALGOL |
Pioneer: Adriaan van Wijngaarden - Dutch pioneer; ARRA, ALGOL |
||
</pre> |
</pre> |