Re: sh script writing help
Dan Nelson wrote: In the last episode (May 30), Aiza said: In a .sh type script I have exerr very long message gt 250 char all on the same line. This is a real pain to edit. Is there some code a can use to continue this on the next line so I can see it on the screen and still have the command function? I tried \ with no luck. \ should work just fine: $ echo long line \ split onto two long line split onto two $ You example works only because the continuation starts at position 1. $ [ -n ${test-name-fowarding} -o -n ${test-noname} ] || \ exerr \ this is for ease of reading the code but will display with a bunch of spaces in the middle of the sentence. The \ works fine bypassing all white space between code not so for white space between the . Is there a coding method to get around this? ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: sh script writing help
On Sun, 30 May 2010 14:10:36 +0800 Aiza aiz...@comclark.com wrote: Dan Nelson wrote: In the last episode (May 30), Aiza said: In a .sh type script I have exerr very long message gt 250 char all on the same line. This is a real pain to edit. Is there some code a can use to continue this on the next line so I can see it on the screen and still have the command function? I tried \ with no luck. \ should work just fine: $ echo long line \ split onto two long line split onto two $ You example works only because the continuation starts at position 1. $ [ -n ${test-name-fowarding} -o -n ${test-noname} ] || \ exerr \ this is for ease of reading the code but will display with a bunch of spaces in the middle of the sentence. The \ works fine bypassing all white space between code not so for white space between the . Is there a coding method to get around this? Do you try to read your expression from a file? exerr `cat /path/to/data` the contents of /path/to/data are your very long string. Regards, -- Anh Ky Huynh ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: sh script writing help
Anh Ky Huynh wrote: On Sun, 30 May 2010 14:10:36 +0800 Aiza aiz...@comclark.com wrote: Dan Nelson wrote: In the last episode (May 30), Aiza said: In a .sh type script I have exerr very long message gt 250 char all on the same line. This is a real pain to edit. Is there some code a can use to continue this on the next line so I can see it on the screen and still have the command function? I tried \ with no luck. \ should work just fine: $ echo long line \ split onto two long line split onto two $ You example works only because the continuation starts at position 1. $ [ -n ${test-name-fowarding} -o -n ${test-noname} ] || \ exerr \ this is for ease of reading the code but will display with a bunch of spaces in the middle of the sentence. The \ works fine bypassing all white space between code not so for white space between the . Is there a coding method to get around this? Do you try to read your expression from a file? exerr `cat /path/to/data` the contents of /path/to/data are your very long string. Regards, Thanks I never though of that solution. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: sh script writing help
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 30/05/2010 07:58:58, Aiza wrote: Anh Ky Huynh wrote: On Sun, 30 May 2010 14:10:36 +0800 Aiza aiz...@comclark.com wrote: Dan Nelson wrote: In the last episode (May 30), Aiza said: In a .sh type script I have exerr very long message gt 250 char all on the same line. This is a real pain to edit. Is there some code a can use to continue this on the next line so I can see it on the screen and still have the command function? I tried \ with no luck. \ should work just fine: $ echo long line \ split onto two long line split onto two $ You example works only because the continuation starts at position 1. $ [ -n ${test-name-fowarding} -o -n ${test-noname} ] || \ exerr \ this is for ease of reading the code but will display with a bunch of spaces in the middle of the sentence. The \ works fine bypassing all white space between code not so for white space between the . Is there a coding method to get around this? Do you try to read your expression from a file? exerr `cat /path/to/data` the contents of /path/to/data are your very long string. A standard means of doing this sort of thing is to use a 'Here' document: if ! [ -n ${test-name-forwarding} -o -n ${test-noname} ]; then exerr -E_O_EXERR x xx xx xxx E_O_EXER fi The '-' operator is a variant on the usual '' operator used for this: the only difference is that it strips leading tabs from the lines in the here document. Cheers, Matthew - -- Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate JID: matt...@infracaninophile.co.uk Kent, CT11 9PW -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.14 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkwCEjQACgkQ8Mjk52CukIzc7gCbBalo5oJcsw+jkXHOm4+8qU3f l2EAn30WwaSL3kTZ1iy3FGkTxQlBZ3pr =WxjG -END PGP SIGNATURE- ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: sh script writing help
On Sun, 30 May 2010 13:14:01 +0800, Aiza aiz...@comclark.com wrote: In a .sh type script I have exerr very long message gt 250 char all on the same line. This is a real pain to edit. Is there some code a can use to continue this on the next line so I can see it on the screen and still have the command function? I tried \ with no luck. If the message does not have to be a *single* command-line argument of the exerr function, you can split the message in multiple arguments and use '\' for continuation lines, e.g.: echo This is a very long message \ that does not fit in a single \ line of text. This might not work if you _have_ to pass the string as a single argument, but even in that case you can use shell substitution to wrap the exerr() function, e.g.: exwrap() { return exerr $* } exwrap This is a very long message \ that does not fit in a single \ line of text. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
sh script writing help
In a .sh type script I have exerr very long message gt 250 char all on the same line. This is a real pain to edit. Is there some code a can use to continue this on the next line so I can see it on the screen and still have the command function? I tried \ with no luck. thanks ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: sh script writing help
In the last episode (May 30), Aiza said: In a .sh type script I have exerr very long message gt 250 char all on the same line. This is a real pain to edit. Is there some code a can use to continue this on the next line so I can see it on the screen and still have the command function? I tried \ with no luck. \ should work just fine: $ echo long line \ split onto two long line split onto two $ -- Dan Nelson dnel...@allantgroup.com ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org