[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: newline in command-line argument?



On Sat, Aug 10, 2002 at 12:16:00PM -0700, Thanasis Kinias wrote:
> scripsit Kendall Shaw:
> > Craig Dickson <crdic@pacbell.net> writes:
>  
> > > On Fri, Aug 09, 2002 at 02:43:39PM -0700, Thanasis Kinias wrote:
> > > > scripsit Kendall Shaw:
> > > > > Can I include a newline in an argument on the command line?
> > > > > 
> > > > > For example, this doesn't work:
> > > > > 
> > > > > A='asdf
> > > > > fdsa'
> > > > 
> > > > How about:
> > > > 
> > > > A="asdf\nfdsa"
> > 
> > Results in: "asdf\nfdsa"
> 
> You need to do 
> 
> echo -e "$A"
> 
> for that to work, so if you're doing this interactively (rather than in
> a script) the
> 
> A="asdf
> fdsa"
> 
> with 
> 
> echo "$A"
> 
> will probably work best.
> 
> > > or:
> > > 
> > > A=asdf\
> > > fdsa
> > 
> > Results in: asdffdsa
> 
> Using the slash that way does the very opposite of what you want -- it
> "hides" the newline so you can type a very long command on multiple
> lines to avoid scrolling.

Okay, that was my suggestion - I'd misunderstood the question :-(
> 
> -- 
> Thanasis Kinias
> Web Developer, Information Technology
> Graduate Student, Department of History
> Arizona State University
> Tempe, Arizona, U.S.A.
> 
> Ash nazg durbatul?k, ash nazg gimbatul,
> Ash nazg thrakatul?k agh burzum-ishi krimpatul
> 
> 
> -- 
> To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> 



Reply to: