Re: Distinguer un appel de script bash par son nom

Pàgina inicial

Reply to this message
Autor: Laurent Vivier
Data:  
A: guilde
Assumpte: Re: Distinguer un appel de script bash par son nom
Le 31/01/2017 à 10:20, Frédéric a écrit :
> Le 31/01/2017, Laurent a écrit :
>
>>> Comment peut-on faire ça ?
>>
>> echo $0
>
> Vi, ok, mais ensuite ? Faut tout se palucher à coudp de sed, ou existe-t-il
> une option un peu plus haut niveau intégrée à bash pour ça ?
>


tu peux faire:

case $0 in
*/toto.sh) echo ceci est toto ;;
*/titi.sh) echo ceci est titi ;;
esac

Laurent