[NTLUG:Discuss] Help with script

Leroy Tennison leroy_tennison at prodigy.net
Sat Mar 20 03:00:02 CDT 2010


Eric Schnoebelen wrote:
> Leroy Tennison writes:
> - I'm attempting to "wrap" HTML around a script's output in order to make
> - the output "pretty" but I also need to output the "real" commands in the
> - script (but not the ones doing the "beautification").  My current
> - attempt looks like:
> - 
> -     function pretty {
> -     echo "<tr><td>" $@ "</td></tr><tr><td>"
> -     $@
> -     echo "</td></tr>"
> -     }
>
> Change to:
> 	function pretty {
> 		echo "<tr><td>" "$@" "</td></tr></tr><td>"
> 		eval "$@"
> 		echo "</td></tr>
> 	}
>
> eval has the effect of creating a shell environment for the
> command to be interpreted and executed in. And providing the
> output and status back to the calling environment.
>
> - It seems that $@ has to be an executable program, nothing else works. 
> - Executing the script with -v or -x doesn't add much except parts of the
> - command are being quoted.  Any one know how to solve this problem?  Much
> - thanks.
>
>
> --
> Eric Schnoebelen		eric at cirr.com		http://www.cirr.com
>   "As far as I know, there will be no more unplanned surprises this week."
>
> _______________________________________________
> http://www.ntlug.org/mailman/listinfo/discuss
>
>   
THANK YOU, this solved my problem and salvaged a day's worth of frustration.



More information about the Discuss mailing list