Path: csiph.com!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: iso646.h Date: Fri, 02 Feb 2024 08:39:28 -0800 Organization: None to speak of Lines: 24 Message-ID: <87y1c2om67.fsf@nosuchdomain.example.com> References: <86zfwnc34o.fsf@linuxsc.com> <86il3bb7rb.fsf@linuxsc.com> <87v879qdmc.fsf@bsb.me.uk> <878r44q73s.fsf@nosuchdomain.example.com> MIME-Version: 1.0 Content-Type: text/plain Injection-Info: dont-email.me; posting-host="a25c07b6296b5291e04aff5e5cd7fea7"; logging-data="2817526"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/vVNXn+NsIGCBfjdvUXTAf" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Cancel-Lock: sha1:54IUzombCPw2eV79a2V6FNV8tB4= sha1:V+mb5vCfkReo7ZkuVE2C1pUp/nE= Xref: csiph.com comp.lang.c:381619 Janis Papanagnou writes: > On 01.02.2024 21:09, Keith Thompson wrote: >> [...] I would use semicolons instead: >> >> $ if file /tmp/garage.jpg | grep JPEG > /dev/null ; then echo "it is a jpeg" ; fi >> it is a jpeg >> >> (I might also use "grep -q" rather than redirecting to /dev/null.) > > And probably also avoid multi-line code (to prevent the ^J confusion) > > file /tmp/garage.jpg | grep -q JPEG && echo "it is a jpeg" Sure, that works, but I usually find the "if" form clearer. (It's not multi-line.) In C code or in a shell script, I'd write a similar "if" statement across multiple lines. In an interactive shell, I commonly write complex commands lie that on one line. YMMV. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Working, but not speaking, for Medtronic void Void(void) { Void(); } /* The recursive call of the void */