Re: Scripting



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)"

--
c.e@xxxx
.



Relevant Pages

  • Accesing structures data (getting lengthy!)
    ... > assignment statement just won't stand out amongst all the other ... > meaningless dummy variables that you have to keep track of. ... > comparitively easy to pick out of a long, boring, command line history, ... > original, for some reason, wraps me up in knots. ...
    (comp.soft-sys.matlab)
  • Re: My Weekly Drash - Vayera
    ... you're asking what reason there might be for a ... >> literally speaking in one voice) and concluding that the law had never ... I have problem with that understanding, ... Because when the command _to him_ is to do ...
    (soc.culture.jewish.moderated)
  • Re: My Weekly Drash - Vayera
    ... >>> while I said I prefer to know the purpose of a law. ... > a reason. ... >> impart a reson to G-d's command. ... Moshe Schorr ...
    (soc.culture.jewish.moderated)
  • Re: 8.0 rc.d scripts less verbose?
    ... bug, but it's a bug that we've come to depend on. ... This late in the release cycle I'm comfortable adding a knob, ... pre-command routine or the command itself failed. ... whatever reason), it is nice to have an approximate idea which one ...
    (freebsd-stable)
  • Re: Some Comments on an "Adventure Engine"
    ... a brass lantern with rusted hinges. ... So there is no reason to deal with explicit numeric equivalences. ... If you're expecting the player to enter these numeric values ... instead of typing a command (gee, ...
    (alt.lang.asm)