Gentoo Archives: gentoo-user

From: Ian Zimmerman <itz@××××××××××××.org>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Re: Why bash script, that works in "Debian", does not work on "Gentoo" install CD?
Date: Sat, 29 Jul 2017 21:52:56
Message-Id: 20170729215244.7id4fuzvzddvnb2x@matica.foolinux.mooo.com
In Reply to: [gentoo-user] Re: Why bash script, that works in "Debian", does not work on "Gentoo" install CD? by Grant Edwards
1 On 2017-07-29 20:07, Grant Edwards wrote:
2
3 > > Correct. All my scripts run with IFS='' so for me it does work ;-)
4 >
5 > Ah, I hadn't thought about that. I might have to thy that. It makes
6 > code cleaner-looking when you don't have to put all varible references
7 > inside double-quotes. But, in what ways is it going to trip me up
8 > after all these decades of writing shell scripts the old way?
9
10 Well, anywhere you expand an unquoted variable, or command output via ``
11 or $(), and depend on it being split into separate words.
12
13 I now religiously use this idiom:
14
15 ifson ; set -- $( foo ) ; ifsoff
16
17 for x ; do bar $x ; done
18
19 to act on separate words output from foo.
20
21 Basically, I am trying to make my sh(1) scripts look like rc(1) scripts,
22 without the rc bugs and missing features.
23
24 --
25 Please don't Cc: me privately on mailing lists and Usenet,
26 if you also post the followup to the list or newsgroup.
27 Do obvious transformation on domain to reply privately _only_ on Usenet.