Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am using zsh and like it very much, but work a lot with Android source which has compilation scripts that require bash to be evaluated correctly. These scripts need to be sourced prior to compilation and define environment variables and shell functions that are used during compilation.

Zsh cannot source these files, and if I try to issue emulate bash my shell becomes non-functionnal with plenty of these error every time I hit space (I am using oh-my-zsh, maybe that is a cause?):

url-quote-magic:24: bad pattern: ( ):/(|/localhost)/*

Is there a way for me not to switch to bash to evaluate these files, or to invoke a bash instance and import the new environments variables/functions it defined during sourcing into my zsh session? Or I am doomed to switch to bash every time I need to work on Android?

EDIT: found an answer to my own question. Sourcing a file using another shell does not seem to be possible, but in the case of Android macro files failing, this page brought a fix:

http://nilvec.com/building-cyanogen-from-source/

Basically, simply setting unsetopt nomatch will ask zsh to stop complaining about unmatched wildcards, which is enough to bring the scripts to completion. There will still be one error remaining, about the use of the complete bash internal command to add completion capabilities to one Android macro, but it is absolutely not critical here.

share|improve this question
add comment

1 Answer

You could put your compilation commandline in a bash script, which sources the compilation scripts bevor executing the compilation command.

Something like

    #!/bin/bash
    . /path/to/environmentscript
    . /path/to/morefunctionsscript

    compile_command

Then instead of invoking compile_command by hand, you just invoke your new bash script.

share|improve this answer
    
That's a potential solution, but unfortunately the environment scripts take several seconds to complete and the compile command varies a lot. Therefore I cannot rely on this to work daily. –  Gnurou Feb 8 '12 at 14:52
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.