Re: Scripting



#!/bin/bash
for i in $(command)
do
j=$(echo "$i" | cut -f4)
k=$(echo "$i" | cut -f3)
[ "$j" = "busy" ] && syscheck "$k"
done
#

where "command" gives your table, "cut" assumes tabs are the column
delimiters. - man cut

For some reason, $i does not contain the complete line. It only contains one
column...

Tried a very simple run and you can see that each line output by the ls -l
command is split up.

bash-2.05$ for i in $(ls -l) ; do(echo $i ) ; done
total
2349
lrwxrwxrwx
1
root
root
9
Nov
27
15:01
bin
->
../usr/bin
drwxr-xr-x
2
root
root
512
Dec
4
12:01
cdrom
-rw-------
1
root
other
671216
Dec
3
09:38
core
drwxr-xr-x


FWIW, I just realized that this is actually running on SunOS:

bash-2.05$ uname -a
SunOS ov2co.cg 5.9 Generic_122300-11 sun4u sparc SUNW,Sun-Fire-V240


.



Relevant Pages

  • Cant mount CD-R/DVD drive!
    ... I'm a relative Linux newbie using 8.2 (and trying to get back into it after ... not using it for a while), and am trying to mount my CD-ROM drive. ... I attempt to see what's on the drive (su to root): ... drwxr-xr-x 21 root root 520 2004-12-03 18:04 .. ...
    (alt.os.linux.suse)
  • Re: host file / DNS not working right on 4.3.3
    ... on /etc/ it is drwxr-xr-x ... I think you are right on target. ... > As root I could ftp to another machine using. ...
    (AIX-L)
  • RE: FC9 Compromised...
    ... -- I yanked the drive and scanned it in a clean machine. ... someone a local shell and when that happens, ... of time before they get root. ... It would stand to reason that they got your root password ...
    (Fedora)
  • Re: Reference for a cubic with a double root?
    ... self-evident to those who do remember their Algebra ... A 'Calculus' approach according to which there will be a double root ... I still need a reference where the condition ... is a reason that D is called "discriminant", ...
    (sci.math)
  • Re: install rpms as root or ...? was Re: Custom Kernel Creation Documentation Online
    ... finally attempt to install binary RPM, ... root, or run the program as root (for example, it's a service, or ... The more usual reason is to avoid damange from bugs either present in ...
    (Fedora)