Hi
I have the following case statement:
case $larg in
** )
a=${larg%}; b=${larg#_};
;;
*^* )
a=${larg%^}; b=${larg#^};
;;
esac
I cannot figure out what *_* and *^* stand for...
Also what a=${larg%}; b=${larg#}; and
a=${larg%^}; b=${larg#^}; calls do
Thanks a lot for help and your time -A
Moumou
2
Hi,
First *_* : it represent a string in two (or more) parts as follow :
Note that the * represent whatever char you want.
(of course, *^* is the same but with ^ instead of _ )
Secondly a=${larg%}; b=${larg#} :
It means that in a you will put all what is before "" in your string and in b all what is after "".
With the example I wrote, you will have
For more info on string manipulation, I advise you this website (in french I'm sorry...) :
Tutoriel de Bash: Les cha�nes de caract�res - La bo�te � prog
I hope I am claer enough so that you understand...
Regards