Deutsch   English   Français   Italiano  
<v9f5c1$3q99m$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Lawrence D'Oliveiro <ldo@nz.invalid>
Newsgroups: comp.unix.shell
Subject: IFS=$'\n'
Date: Tue, 13 Aug 2024 08:26:41 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <v9f5c1$3q99m$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 13 Aug 2024 10:26:41 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="dcc5997f875115997406f45b29a1ceee";
	logging-data="4007222"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19Um9kI9EH0A8g53UQ5FpDu"
User-Agent: Pan/0.159 (Vovchansk; )
Cancel-Lock: sha1:pZEtGWaKjxcO2MIo+WACZyamcOU=
Bytes: 1633

I like having spaces in file/directory names, but I avoid putting newlines 
in them.

This plays havoc with the shell’s word-splitting rules, because the 
default value for IFS is

    IFS=$' \t\n'

which means names with spaces in them get split into separate items, 
triggering lots of errors about items not found (or the wrong items found/
created).

However, if you change this to

    IFS=$'\n'

then this can make things much more convenient (provided you can be sure 
there are no newlines in your file names). For example, I can do

    ls -lt $(find . -type f -iname \*fred\*)

to search for all filenames containing “fred” in the hierarchy rooted at 
the current directory, and display them in reverse chronological order.