![]() |
| |||
| opexoc@gmail.com writes: >Hi. I was trying to write script which will be do something when >program called kadu is executed. It is this script ( or some prototype >of this script ): >------------------------------------------- >#!/bin/bash >export var=0 >ps aux | awk '/[k]adu/ { ENVIRON["var"]++ } END{ print ENVIRON["var"] >}' What is this line supposed to do? What is ENVIRON["var"]++ supposed to do? What is will do is to read the value of the var variable ( more easily done by '$var' ) and incriment that read value. It does nothing to the value of var. Rather than use this script just do if ps aux|grep -v grep|grep '[k]adi'>/dev/null ; then Run your command fi >echo $var >if [ $var = "1" ] >then > echo "1" >else > echo "0" >fi >------------------------------------------- >My main problem is to import content of variable "var" from awk. I >thought that when I will use "export" command and I make "var" some >global variable it will works, but it didn't. How can you help me ? >best regards, >opexoc |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |