From: David W. Hodgins on 10 Jun 2010 23:33 On Thu, 10 Jun 2010 21:26:28 -0400, moonhkt <moonhkt(a)gmail.com> wrote: > When using indent program to reformat shell program as below. how to > using cat << as normal ? > > k=1 > if [ k != 0 ] ; then > cat <<-EOF > Hello World. > EOF > fi > > test_eof.ksh[2]: 0403-057 Syntax error at line 2 : `<' is not matched. unexpand -t 4 test_eof.ksh>test2.ksh Regards, Dave Hodgins -- Change nomail.afraid.org to ody.ca to reply by email. (nomail.afraid.org has been set up specifically for use in usenet. Feel free to use it yourself.)
From: moonhkt on 10 Jun 2010 23:41 On 6æ11æ¥, ä¸å11æ¶33å, "David W. Hodgins" <dwhodg...(a)nomail.afraid.org> wrote: > On Thu, 10 Jun 2010 21:26:28 -0400, moonhkt <moon...(a)gmail.com> wrote: > > When using indent program to reformat shell program as below. how to > > using cat << as normal ? > > > k=1 > > if [ k != 0 ] ; then > >   cat <<-EOF > >   Hello World. > >   EOF > > fi > > > test_eof.ksh[2]: 0403-057 Syntax error at line 2 : `<' is not matched. > > unexpand -t 4 test_eof.ksh>test2.ksh > > Regards, Dave Hodgins > > -- > Change nomail.afraid.org to ody.ca to reply by email. > (nomail.afraid.org has been set up specifically for > use in usenet. Feel free to use it yourself.) Any good indent program for ksh ? Some of programs, using cat << to build text file. I download someone perl program for indent ksh. fmt.pl -s4 -ksh test_eof.ksh > abc.ksh usage: fmt.pl -help fmt.pl [-t|-s#] [-ksh|-sh] [infile [outfile]] -t indent is one tab character (default) -s# indent is <#> space characters -sh script is Bourne shell -ksh script is Korn shell infile input file name (default STDIN) outfile output file name (default STDOUT) notes: * you can use '-' for STDIN/STDOUT * fmt.pl gives outfile execute permissions when possible example: * to convert an ugly script into a pretty script, using a 4space indent: fmt.pl -s4 script.ugly script.pretty
From: Thomas 'PointedEars' Lahn on 11 Jun 2010 04:56 Ben Finney wrote: > gazelle(a)shell.xmission.com (Kenny McCormack) writes: >> Replace the above with: >> >> echo "Hello World." > > Or, more portably: > > printf "Hello World.\n" How did you get that idea? PointedEars
From: Kenny McCormack on 11 Jun 2010 08:13 In article <2348862.I6sBWrkQq0(a)PointedEars.de>, Thomas 'PointedEars' Lahn <usenet(a)PointedEars.de> wrote: >Ben Finney wrote: > >> gazelle(a)shell.xmission.com (Kenny McCormack) writes: >>> Replace the above with: >>> >>> echo "Hello World." >> >> Or, more portably: >> >> printf "Hello World.\n" > >How did you get that idea? It is one of the doctrinaire points of this NG that echo is "non-portable". So, you use the equivalent printf if you want people to think you are cool. -- (This discussion group is about C, ...) Wrong. It is only OCCASIONALLY a discussion group about C; mostly, like most "discussion" groups, it is off-topic Rorsharch [sic] revelations of the childhood traumas of the participants...
From: Seebs on 11 Jun 2010 09:32
On 2010-06-11, Thomas 'PointedEars' Lahn <PointedEars(a)web.de> wrote: > Ben Finney wrote: >> gazelle(a)shell.xmission.com (Kenny McCormack) writes: >>> Replace the above with: >>> echo "Hello World." >> Or, more portably: >> printf "Hello World.\n" > How did you get that idea? In this particular case, there's no real difference. As a general rule, if you have a choice between echo(1) and printf(1), you should use printf(1) often enough that it's probably best to just always use it. Obviously, in this case, they're identical. However, if you have any variable expansion going on, it is quite easy for echo to blow up in inconvenient and/or surprising ways, where printf will be just fine. Add in the portability hassles induced by the whole -n\c thing, and the difficulty of sanitizing inputs enough to make sure that you aren't going to run afoul of some "helpful" extension... -s -- Copyright 2010, all wrongs reversed. Peter Seebach / usenet-nospam(a)seebs.net http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated! |