Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] "How to"
- Date: Sat, 17 May 2014 14:49:14 +0200
- From: Bruno Raoult <braoult@example.com>
- Subject: Re: [tlug] "How to"
- References: <CAJA1Y2bTWLWhb0tcuZyeJQDXtAXsGRdyUw_T_Ft7sZ_W6nXhLQ@mail.gmail.com> <537162A7.5090009@extellisys.com> <877g5qfidc.fsf@uwakimon.sk.tsukuba.ac.jp> <CAJA1Y2a9+YBtoB0Yv57BL=a=t8DBTyhT05F5cokhVocJmEa=hg@mail.gmail.com> <87r43sfvvs.fsf@uwakimon.sk.tsukuba.ac.jp>
On Sat, May 17, 2014 at 2:11 PM, Stephen J. Turnbull <stephen@example.com> wrote: > > $ echo foo^Mecho bar > > echo bar > > $ echo foo; echo bar > > foo > > bar > > No, I was talking about in the context of a code block (such as a loop > or a function body). I think it looks better than a long line broken > by colons. I don't see when it would be useful for standalone > commands. I am not sure in a loop either... ^M does not help. > > > Splitting lines with \ <RET> is also occasionally > > > useful (but I forget how it interacts with things like strings). > > > > Easy: It just escapes nest character special meaning: > > $ echo foo\ > > > bar > > foobar > > That's not a string. I'm talking about the things bounded by pairs of > " or '. If the string is inside ', the \ will loose its meaning. Inside ", this is less clear, and I prefer generally to avoid it (just afraid, I am a coward :-) br@lorien:/export/home/br$ a=b br@lorien:/export/home/br$ echo "c$a" cb br@lorien:/export/home/br$ echo "c\$a" c$a br@lorien:/export/home/br$ echo "c\ > $a" cb br@lorien:/export/home/br$ echo "c > $a" c b But I use a lot of "\" in my code (beside strings), for instance for long command lines that I want to read mode easily. For example: rsync \ -aHixv \ "${FILTER}" \ ${RSYNCOPTS} \ ${COMPRESS} \ --delete \ --delete-during \ --delete-excluded \ --modify-window=1 \ --partial \ --link-dest="${ldest}" \ . \ "${DEST}/daily-00" || status=$? I do it also for strings, but I will tend to use the << notation when it becomes long; this allows to use " and ' in the string. But this is just a personal choice, "\" is of course perfect too... br. -- 2 + 2 = 5, for very large values of 2.
- References:
- [tlug] "How to"
- From: Bruno Raoult
- Re: [tlug] "How to"
- From: Travis Cardwell
- Re: [tlug] "How to"
- From: Stephen J. Turnbull
- Re: [tlug] "How to"
- From: Bruno Raoult
- Re: [tlug] "How to"
- From: Stephen J. Turnbull
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] Poll: OpenOffice or LibreOffice?
- Next by Date: Re: [tlug] Poll: OpenOffice or LibreOffice?
- Previous by thread: Re: [tlug] "How to"
- Next by thread: [tlug] Compose key and IME clash?
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links