Jump to content
GoOz

Run Script object adds a carriage return to {query} when using echo with bash

Recommended Posts

Bug reproduced at both home and work.

 

Configs :

@home:

OSX: 10.7

Alfred: v2.0.1 build 173

 

@work:

OSX: 10.6

Alfred: v2.0.1 build 173

 

Origin

This topic

 

Step to reproduce

NB: I did a brand new workflow to be sure it was clean of any extra hidden space or carriage return.

 

Basically it looks like this:

test_workflow_2.png

 

  • A keyword object with arg to pass the {query}
  • Run Script object uses /bin/bash and simply does an echo "foobar"
  • Output 1 displays the {query}
  • Output 2 displays display the text in the text field (e.g. foobar)
  • Output 3 displays the {query} passed by the script.

 

When i trigger the workflow with "foobar" as an argument, this is what i got :

notifs.png

 

As you can see the {query} passed by the script has an extra space at the bottom.

 

As harmless as it seems, it's not :)
Can't properly use the {query} in a bash script because of this.

 

Do you confirm?

Share this post


Link to post
Share on other sites

Bug reproduced at both home and work.

 

Do you confirm?

 

If you are echoing out of bash, are you using -n to prevent a newline from being added?

Share this post


Link to post
Share on other sites

Damn, you're good.

 

Well in my example, if i add -n, it does work.

 

But oddly, as i explained in the original topic, it wouldn't work if i translate with a sed.

 

I had echo -n "{query}" | sed -e 's/://g;s/\\/\//g;s/^\(.*\)$/file:\/\/\/Volumes\/\1/' and the output had still the newline.

The query before sed hasn't the newline and after it has it.

 

I finally got it with a tr -d '\n'

 

Took me a week to figure it out.

 

Anyway, i can't find how to flag the topic as resolved, i guess you do that, right?

Share this post


Link to post
Share on other sites

×
×
  • Create New...