RE: bash question
- From: "Miner, Jonathan W (CSC) (US SSA)" <jonathan.w.miner@xxxxxxxxxxxxxx>
- Date: Wed, 31 Oct 2007 09:28:05 -0400
-----Original Message-----
From: fedora-list-bounces@xxxxxxxxxx on behalf of Dario Lesca
Sent: Wed 10/31/2007 09:12 AM
To: Fedora Project List
Cc:
Subject: bash question
In this shell script:
#!/bin/bash
i=0
printf "a a a\nb b b\nc c c\n" |
while read x
do
i=$[i+1]
echo "$x: ($i)"
done
echo $i
-------------------------------
By pipe'ing the commands together, you cause the while loop to be executed in a subshell. Change your script to be:
#!/bin/bash
i=0
while read x
do
i=$[i+1]
echo "$x: ($i)"
done << _EOF_
a a a
b b b
c c c
_EOF_
echo $i
<<winmail.dat>>
--fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
- Follow-Ups:
- Re: bash question
- From: Sjoerd Mullender
- RE: bash question
- From: Dario Lesca
- Re: bash question
- References:
- bash question
- From: Dario Lesca
- bash question
- Prev by Date: bash question
- Next by Date: Which Server one Should Run-SLAPD/LDAP?
- Previous by thread: bash question
- Next by thread: RE: bash question
- Index(es):
Relevant Pages
|
|