bash programming

Steve Stavropoulos steve at math.upatras.gr
Sun May 27 10:29:01 EEST 2001


On Sun, 27 May 2001, Alex wrote:

> Hi all!
>
> Logw university policy, prepei ta dialup sessions mou na mhn pernane tis 6
> wres. Opote xrhsimopoiw to at gia na lew sto linux pote na skotwnei to
> process tou wvdial. To problhma einai oti to kill ap'oti kserw douleyei mono
> me PID, kai oxi me process name.
>
> Synepws, otan prokeitai na leipsei kaneis apo to plhktrologio panw apo 12
> wres kai 8elei entwmetaksy na riksei th syndesh - ksanasynde8ei - thn
> ksanariksei - ksanasynde8ei, yparxei ena mikro problhma. Oti dhladh to PID
> tou deyterou wvdial pou 8a treksei meta apo 6 wres den einai gnwsto.
>
> Ara prospa8oume na to ma8oume. Pros to paron katelhksa sthn entolh-makaroni
>
> WVDIAL=`ps | grep wvdial | grep -v pppd | grep -v "grep"`;kill -9 $WVDIAL
>
> h opoia douleyei men, opws katalabainete den einai ka8olou kompsh de.
>

kill `pidof wvdial`

>
> Prwton, giati an DEN kanw kill -9 me ftynei kai den kanei kill to process?
> Dhladh giati den douleyei h entolh kill $WVDIAL ?
>
> Deyteron, yparxei kapoios tropos na apo8hkeysw sto variable pou 8elw mono to
> prwto token tou output tou grep? Twra dhladh h entolh pou trexei einai kati
> tou styl
>
> kill -9 1106 pts/1 00:00:00 wvdial
>
> Mporw na to periorisw ayto se ena pio swsto kill 1106? Dhl. na pairnei mono
> tous prwtous 4 xarakthres apo to output kai na tous apo8hkeyei sto variable,
> oxi olo to output tou grep.
>

to pidof pou eipa pio prin 8a sou dwsei mono pid, opote den exeis prob.
Alla genikws an 8es to prwto pedio apo ena string tote mporeis na
xrhsimopoihseis to cut:

ps ax | grep wvdial | grep -v grep | cut -d " " -f 1

ayto 8a sou bgalei to pid tou wvdial.

me to -d dineis to delimiter, space edw.
me to -f tou les poio field 8es na typwsei, to prwto edw.


>
>
> PS: Se ayta me boh8hse ena online biblio gia shell programming (SAMS teach
> yourself in 24hrs series), opoios endiaferetai as koitaksei sthn
> http://infobase.informit.com/linux/
>
> exei arketa+endiaferonta+free biblia gia newbies
>

 Poly ta antipa8w ta biblia tou typou: "Ma8ete na ka8arizete kremmydia se
24 wres"





More information about the Linux-greek-users mailing list