I want to use xonsh to bzip several files in a directory. I first attempt this with the following:
$ 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
OK, so I use $()
explicitly
$ 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.
Is there a better way to do this?
$ xonsh --version
('xonsh/0.3.4',)