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

Re: Script challenge



On Sat, 14 Jan 2006 11:37:42 +0100
John Smith <netman1@home.nl> wrote:


> 	which heroe can tell me why the following does not work :
> 
> #!/bin/sh
> cat <<EOF >thenewscriptfile.sh
> #!/bin/sh
> ... input for thenewscriptfile.sh
> EOF
> 
> 	It's driving me nuts!!!
> 

That's why I like Debian, and especially the userlist:

3 correct answers within a few hours:

- quoting the whole contents for the new script file (David)
  (simple, but accidentily inserting a quote within the
   block fsck's up your whole new script)
- escape all the $'s of the new content (Simo)
  (cumbersome, prone to mistakes by forgetting one, but clearly 
   indicates that you are working with special, not locally 
   activated code)
- prevent $ expanding by quoting the "where" (Almut)
  (only advantages, clearly the choice to be made)

As I said: three heroes!

Thanks people!

Sincerely,

Jan.



Reply to: