Re: Scripting
- From: "Calab" <myspam@xxxxxx>
- Date: Mon, 31 Dec 2007 10:16:56 GMT
"Chris Elvidge" <chris.elvidge@xxxxxxxxxxxxxxxx> wrote in message
news:c3om45-1e1.ln1@xxxxxxxxxxxxxxxxxxx
Calab wrote:
#!/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
try for i in "$(ls -l)"
Nope... that returns ALL of the ls output as a single line, instead of an
instance of $i for each line.
.
- Follow-Ups:
- Re: Scripting
- From: Chris Elvidge
- Re: Scripting
- References:
- Scripting
- From: Calab
- Re: Scripting
- From: Chris Elvidge
- Re: Scripting
- From: Calab
- Re: Scripting
- From: Chris Elvidge
- Scripting
- Prev by Date: Re: Scripting
- Next by Date: Re: Scripting
- Previous by thread: Re: Scripting
- Next by thread: Re: Scripting
- Index(es):