Algu?m me explica...

Matias Schweizer <matias-7pUm/SSSJFa7hsvYdc9FTl/I71DsQ//[email protected]>
Newsgroups gmane.org.user-groups.linux.parana
Message-ID <[email protected]>
	
	Pessoal:

	Faz tempo que não caio em pegadinha de shell...Alguém explica
	pq o echo $X ao final das sequências é diferente?

1-----------------------------------------------------------------------
sor@plutao:~$ X=1
sor@plutao:~$ while [ $X -lt 18 ];do X=`expr $X + 1`;echo $X;done
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
sor@plutao:~$ echo $X
18

2 ------------------------------------------------------------------------
sor@plutao:~$ X=1
sor@plutao:~$ cat /etc/passwd|while read line
> do 
> X=`expr $X + 1`
> echo $X
> done 
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
sor@plutao:~$ echo $X
1

???????

[]'s

Matias Schweizer
matias-7pUm/SSSJFa7hsvYdc9FTl/I71DsQ//[email protected]
SCHNAUZER Plastimodelismo
http://www.spmodelismo.com.br/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.