Question

#!/bin/bash
cp "$1" tmpmulti
ex tmpmulti << 'HERE'
%s/.*/echo "&:" "validate_html &"/
wq
HERE
/bin/bash tmpmulti
rm tmpmulti

So I'm building this script with the purpose to validate multiple html sites through the w3c validator.(school exercise).

The script gets as input a text files with multiple links. I already made a validate script for a single site which is working(validate_html). I'm trying to get this script to the following format:

www.xxx.xx : This document was successfully checked as XHTML 1.0 Strict!
www.yyy.yy : Errors found while checking this document as XHTML 1.0 Transitional!

But when I use my script i get :

www.xxx.xx : validate_html www.xxx.xx
www.yyy.yy : validate_html www.yyy.yy 

The validate_html script isn't executing (It works when it's called alone)

Anyone got some advice? :)

Was it helpful?

Solution

Have you tried something like that? I have added the $() around your validate_html so it'd be executed and not simply printed.

#!/bin/bash
cp "$1" tmpmulti
ex tmpmulti << 'HERE'
%s/.*/echo "&:" "$(validate_html &)"/
wq
HERE
/bin/bash tmpmulti
rm tmpmulti
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top