[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[shell-script] pegar versão do bash (was: txt2regexp.sh)
From: |
Eliphas Levy Theodoro |
Subject: |
[shell-script] pegar versão do bash (was: txt2regexp.sh) |
Date: |
Fri, 3 Nov 2000 16:40:29 -0200 (EST) |
# aurelio marinho jargas, @ 16:19:
> @ 3/11, Marcos M. S. Rezende:
> > Como que eu posso verificar a versão do meu bash?
>
> olha que essa tem pegadinha, por isso não fiz a checagem de
> versão no próprio script:
>
> prompt$ bash -version
> GNU bash1, version 1.14.7(1)
>
> prompt$ bash --version
> GNU bash, version 2.04.0(1)-release (i386-conectiva-linux-gnu)
> Copyright 1999 Free Software Foundation, Inc.
> embora o -version ainda funcione no bash2, em versões futuras,
> apenas o --version funcionará.
$ echo $BASH_VERSION
2.04.0(1)-release
$ bash1
$ echo $BASH_VERSION
1.14.7(1)
aí dá pra modificar o IFS pra pegar a versão e o release:
#!/bin/sh
OLDIFS="$IFS"
IFS=.
set - $BASH_VERSION
IFS="$OLDIFS"
case $1 in
1) echo bash1;;
2) echo bash2;;
*) echo não sei...;;
esac
--
Conectiva - Theodoro, Eliphas Levy | \
sed 's/\([A-z]*\) - \([A-z]*,\) \([A-z]*\) \([A-z]*\)/\3 \4 \2 \1/'
A conclusion is simply the place where someone got tired of thinking.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [shell-script] pegar versão do bash (was: txt2regexp.sh),
Eliphas Levy Theodoro <=