bash - Meaning of ${PYTHON:-python} in shell script and how to change -


i trying export mercurial repo github using hg-fast-export , github bash windows. choked on line from mercurial import node because mercurial doesn't support python 3.

i installed python 2.7 , tried shebang lines (#! /python27/python) , alias python='c:/python27/python'. worked make python --version report 2.7, hg-fast-export.sh still invokes python 3 because contains line

python=${python:-python} 

and evaluates python 3.4.3.

can explain how change use different python version , what's going on syntax here? couldn't google meaning of ${} or :- in shell. comments on how approach running on windows helpful.

edit: explanations of :-. since parameter expansion not needed, guess answer question "you have set python='c:/python27/python' in same line script use value." expected path can set independently following lines use.

the intent here allow override passed in through environment.

thus, if run @ posix shell:

$ python=python26 hg-fast-export ... 

then in hg-fast-export evaluate ${python:-python} python26.


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -