Jump to content
Sign in to follow this  
krike

Run script not working while terminal command works

Recommended Posts

I'm new to the update of alfred 2 and I'm having some problems when creating a workflow. i would like to run the following script:

cd /application/language/nl_BE/LC_MESSAGES/
grep -v '^#: ' common.po > common.po.tmp && mv common.po.tmp common.po

It works perfectly when I choose 'Actions -> run script' but nothing happens while when I use 'Actions -> terminal command' it works.

Screen_Shot_2014_01_07_at_16_55_53.png

Share this post


Link to post

I'm new to the update of alfred 2 and I'm having some problems when creating a workflow. i would like to run the following script:

cd /application/language/nl_BE/LC_MESSAGES/
grep -v '^#: ' common.po > common.po.tmp && mv common.po.tmp common.po

It works perfectly when I choose 'Actions -> run script' but nothing happens while when I use 'Actions -> terminal command' it works.

Screen_Shot_2014_01_07_at_16_55_53.png

 

Since you are new to Alfred 2, let me explain the difference in case it wasn't already obvious.

 

A run script (with the language set to bash) is the same as running the command from the terminal except it runs it in the background with no new windows popping up.

Terminal command will launch a terminal window and run the command in that new window.

 

If a command works normally in a Terminal Command item, then it should work normally as a Run Script with the language set accordingly as long as the script isn't reliant upon something in your profile settings or environment variables. Alfred doesn't import your environment so, if you have environment variables set that the script would need access to, these would need to be brought into Alfred. Also, paths in Alfred are relative to the folder that the workflow is stored in. So if you needed to access something in your documents folder, you wouldn't just use "cd Documents" assuming that you started in your home directory, you would have to specify full path to your Documents folder.

Share this post


Link to post

Yes I did read about the fact that whatever works in terminal works in run script. But thanks for the tip about the path, that solved the problem.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  
×
×
  • Create New...