Jump to content

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


Recommended Posts

Bug reproduced at both home and work.


Configs :


OSX: 10.7

Alfred: v2.0.1 build 173



OSX: 10.6

Alfred: v2.0.1 build 173



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:



  • 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 :



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?

Link to comment
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?

Link to comment
Share on other sites

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...