Jump to content

XMLScriptFilter with Bash


Recommended Posts

Posted

Hey Guys,

 

I was playing around with the Script Filter XML a bit and now I have the following script, which does not work, but I cant tell why:

cat << EOB

echo "<?xml version='1.0'?>"
echo "<items>"
for line in $(gpg --list-keys | grep -E -o "\b[a-zA-Z0-9.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+\b")
do
    echo "<item uid='$line' arg='$line'>"
    echo "<title>$line</title>"
    echo "</item>"
done
echo "</items>"

EOB

Strange thing is: When I execute the script in my bash an copy the output as xml in the ScriptFilter, everything works fine. I suspect escaping to be the problem, but can not get it to work...

 

Any ideas?

Posted

Hey Guys,

 

I was playing around with the Script Filter XML a bit and now I have the following script, which does not work, but I cant tell why:

cat << EOB

echo "<?xml version='1.0'?>"
echo "<items>"
for line in $(gpg --list-keys | grep -E -o "\b[a-zA-Z0-9.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+\b")
do
    echo "<item uid='$line' arg='$line'>"
    echo "<title>$line</title>"
    echo "</item>"
done
echo "</items>"

EOB

Strange thing is: When I execute the script in my bash an copy the output as xml in the ScriptFilter, everything works fine. I suspect escaping to be the problem, but can not get it to work...

 

Any ideas?

 

Would you mind popping your Powerpack email address into your forum profile (only viewable by me and Vero) before asking for Powerpack support, cheers! :)

 

Andrew

Posted

Hi Andrew,

 

yep I have. If I put the Output from my regular .sh script directly into the Script Filter Window (the static XML) it works fine.

 

Output looks like this...

<?xml version='1.0'?>
<items>
<item uid='blablabla' arg='blablabla'>
<title>blablabla</title>
</item>
...(more items here)
</items>

Thanks, Paul

Posted (edited)

Hey Guys,

 

I was playing around with the Script Filter XML a bit and now I have the following script, which does not work, but I cant tell why:

cat << EOB

echo "<?xml version='1.0'?>"
echo "<items>"
for line in $(gpg --list-keys | grep -E -o "\b[a-zA-Z0-9.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+\b")
do
    echo "<item uid='$line' arg='$line'>"
    echo "<title>$line</title>"
    echo "</item>"
done
echo "</items>"

EOB

Strange thing is: When I execute the script in my bash an copy the output as xml in the ScriptFilter, everything works fine. I suspect escaping to be the problem, but can not get it to work...

 

Any ideas?

 

Why are you using both cat and echo? You should only be using one of them; remove the “cat << EOB” and “EOB” lines, does it work?

Edited by Vítor
  • 2 weeks later...
Posted

Mmmmh, doesnt work either...

 

I uploaded the Workflow, so you can test it. Maybe it works for you. Keep in mind that you need need gpgTools installed: https://gpgtools.org/

 

Download Workflow: http://d.pr/f/AJbK

 

Thanks Very Much

Have you installed gpg via homebrew, or a similar tool? It’s an easy to solve, but frustrating problem. Since Alfred does not read your PATH, you need to add something like PATH=/usr/local/bin:$PATH (or wherever you have gpg installed) to the top of your script, so it can find it.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...