General, /bin/sh, IO, etc...

Scott Yelich scott at cs.odu.edu
Wed Jun 6 03:34:13 AEST 1990


I have a couple of questions that I am working on... and I wouldn't
mind some additional EMAIL input just to help me sort out the answers.

[ I am using either a sun 3/60 or a sparcstation and sunos 4.0.3... ]

1)   Why does IFS affect the commands in a shell, not just the text?
     %sh
     {
      IFS="$IFS-"
      tail -f /usr/spool/mail/$USER
     }
     
     tail: f: No such file or directory

     If I do:
     %sh
     {
      IFS="$IFS-"
      set "H-H"
      echo $#
      VAR=$@
     }
     set $VAR
     echo $#
 
     I get ``1'' then ``2'' so the ``-'' is in there... at one point.

     Do the braces { } create a sub shell (yic!)?
     What about functions?
    
     %sh
     PR=$$
     SUB ()
     {
      SUBPR=$$
      {
       SUBSUBPR=$$
      }
     }          
     SUB
     echo $PR $SUBPR $SUBSUBPR

     I get the same number... but the process table shows ``cat'' by a
different process number and it diagrams it as if it were a sub/child
process!  

The environments are different with some commands!  Like ``for''...

2) What is the bufferring done here?
   %tail -f file | tr "Aa"
   Works...
   %tail -f file | tr "Aa" |\
    while read LINE
    do
      echo $LINE
    done 
    Doesn't work.
   
Is there anyway to get ``tr'' to pass stuff through in this type of a situation?
% tail -f file | tr -d "chars"| loop

What I want to do is trap the ``tr'' in a pipe sequence so I don't
keep calling it.  I could also just use
IFS="all_chars_that_I_want_to_delete" ... but I would much rather get
the `tr' working since one of the characters I want to delete is a
``-''.

Hmmm.... that's enough for now.

 -----------------------------------------------------------------------------
 Scott D. Yelich                         scott@[xanth.]cs.odu.edu [128.82.8.1]
 After he pushed me off the cliff, he asked me, as I fell, ``Why'd you jump?''
 Administrator of:    Game design requests to <game-design-request at cs.odu.edu>
 -----------------------------------------------------------------------------



More information about the Comp.unix.questions mailing list