[LUGOS] Kako izvesti test za prisotnost programa

Miha Furlan miha at furlan.biz
Wed Jun 1 13:18:38 CEST 2005


Ups, hotel sem napisati whereis. :)

Miha Furlan wrote:

> Mogoče bi si lahko pomagal z which?
>
> Gorjanc Gregor wrote:
>
>> Zdravo!
>>
>> Ali mi lahko kdo namigne, kako naj izvedem test v Bash-u za prisotnost
>> dolocenega programa. Do sedaj sem prisel do teh primerov:
>>
>> if [ -f /usr/bin/program ]; then
>>  echo "program obstaja"
>> fi
>>
>> # ta pristop mi ni vsec, ker je lahko program tudi kje drugje npr. /bin
>> # ali /usr/local/bin ali se kje drugje; podoben pristop bi bil z -e
>>
>> if [ `which program` ]; then
>>  echo "program obstaja"
>> fi
>>
>> # to naceloma dela, a sem ze naletel na cel kup variant za ukaz 
>> 'which' in
>> # potem taksen test in z njim tudi skripta ni zelo prenosljiva
>>
>> Se kaksna ideja?
>>
>> Lep pozdrav / With regards,
>>    Gregor Gorjanc
>>
>> ----------------------------------------------------------------------
>> University of Ljubljana
>> Biotechnical Faculty        URI: http://www.bfro.uni-lj.si/MR/ggorjan
>> Zootechnical Department     mail: gregor.gorjanc <at> bfro.uni-lj.si
>> Groblje 3                   tel: +386 (0)1 72 17 861
>> SI-1230 Domzale             fax: +386 (0)1 72 17 888
>> Slovenia, Europe
>> ----------------------------------------------------------------------
>> "One must learn by doing the thing; for though you think you know it,
>> you have no certainty until you try." Sophocles ~ 450 B.C.
>> ----------------------------------------------------------------------
>>
>>
>>
>> _______________________________________________
>> lugos-list mailing list
>> lugos-list at lugos.si
>> http://liste2.lugos.si/cgi-bin/mailman/listinfo/lugos-list
>>  
>>
> _______________________________________________
> lugos-list mailing list
> lugos-list at lugos.si
> http://liste2.lugos.si/cgi-bin/mailman/listinfo/lugos-list



More information about the lugos-list mailing list