0
使用!
魔法我可以訪問env
類型的環境變量,但不是在我的終端中定義的或.bashrc
。如何訪問ipython中的shell變量
$:/<path>/balter/chip-seq-analysis/chipseq$ echo $hg38
/<path>/genomes/hg38/release-85/Homo_sapiens.GRCh38.dna.primary_assembly.fa
[email protected]:/<path>/balter/chip-seq-analysis/chipseq$ ipython
Python 2.7.12 |Continuum Analytics, Inc.| (default, Jul 2 2016, 17:42:40)
Type "copyright", "credits" or "license" for more information.
IPython 5.1.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: !echo $hg38
In [2]: !echo $SHELL
/usr/bin/bash
In [3]:
如果你的變量不是_exported_,沒有子進程可以訪問它們,pyhton與否。 –
那麼,在我的'.bashrc'中,我需要'export hg38 = ....'輸出?我會嘗試的。 – abalter
是的,這是必要的! –