Gentoo Archives: gentoo-dev

From: Ryan Hill <dirtyepic@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] Re: [gentoo-commits] gentoo-x86 commit in net-misc/openvpn: ChangeLog openvpn-2.1.3.ebuild
Date: Sat, 02 Oct 2010 03:35:05
Message-Id: 20101001213856.0556f648@gentoo.org
In Reply to: Re: [gentoo-dev] Re: [gentoo-commits] gentoo-x86 commit in net-misc/openvpn: ChangeLog openvpn-2.1.3.ebuild by Nirbheek Chauhan
1 On Fri, 1 Oct 2010 20:47:38 +0530
2 Nirbheek Chauhan <nirbheek@g.o> wrote:
3
4 > On Fri, Oct 1, 2010 at 6:37 PM, Peter Volkov <pva@g.o> wrote:
5 > > В Пнд, 27/09/2010 в 11:37 +0000, Dirkjan Ochtman (djc) пишет:
6 > >> src_compile() {
7 > >>       use static && sed -i -e '/^LIBS/s/LIBS = /LIBS = -static /' Makefile
8 > >>
9 > >>       emake || die "make failed"
10 > >>
11 > >>       if ! use minimal ; then
12 > >>               cd plugin
13 > >>               for i in $( ls 2>/dev/null ); do
14 > >
15 > > This is bad construction:
16 > > http://mywiki.wooledge.org/BashPitfalls#for_i_in_.24.28ls_.2A.mp3.29
17 > >
18 >
19 > A nice way around this is to do the following:
20 >
21 > ls -1 | while read i; do
22 >
23 > `read` delimits on newline, so you're safe.
24
25 This strips leading and trailing whitespace.
26
27 $ touch " test1"
28 $ touch "test2 "
29 $ touch "test 3"
30 $ touch " test 4 "
31
32 $ ls -1 | while read i; do echo "###${i}###"; done
33 ###test2###
34 ###test 3###
35 ###test1###
36 ###test 4###
37
38 instead use:
39
40 $ ls -1 | while IFS= read i; do echo "###${i}###"; done
41 ###test2 ###
42 ###test 3###
43 ### test1###
44 ### test 4 ###
45
46 or recursively:
47
48 $ find . -type f -print0 \
49 | while IFS= read -d $'\0' i; do echo "###${i}###"; done
50 ###./ test1###
51 ###./ test 4 ###
52 ###./test 3###
53 ###./test2 ###
54
55 or just make things simple on yourself :)
56
57 $ for i in *; do echo "###${i}###"; done
58 ### test1###
59 ###test2 ###
60 ###test 3###
61 ### test 4 ###
62
63
64 --
65 fonts, gcc-porting, we hold our breath, we spin around the world
66 toolchain, wxwidgets you and me cling to the outside of the earth
67 @ gentoo.org EFFD 380E 047A 4B51 D2BD C64F 8AA8 8346 F9A4 0662

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies