我想使用 xonsh 来 bzip 目录中的几个文件。我首先尝试以下方法:
$ ls
table_aa.csv table_amgn.csv table_csco.csv table_esrx.csv table_hal.csv table_jbl.csv table_pcg.csv table_zmh.csv
table_aapl.csv table_amzn.csv table_d.csv table_gas.csv table_hp.csv table_jpm.csv table_usb.csv
$ for fn in ls:
.. bzip2 fn
..
NameError: name 'ls' is not defined
好的,所以我$()
明确使用
$ for fn in $(ls).split():
. bzip2 fn
bzip2: Can't open input file fn: No such file or directory.
bzip2: Can't open input file fn: No such file or directory.
有一个更好的方法吗?
$ xonsh --version
('xonsh/0.3.4',)