I wouldn't bother with shebangs in your Python files (or with making them exectuble, i.e. using chmod
on them).
Instead, I'd create a bash
script (with shebang) to orchestrate things. E.g. something like this:
#!/bin/bash
symbol=$1
start=$2
echo "Retrieving frame for $symbol, starting from $start"
nix-shell --run python retrieve-frame.py $symbol $start
echo "Openning retreived data with vd"
nix-shell --cmd vd $symbol.frm
You'd have to change retrieve-frame.py
to the whatever you've called your Python file for retrieving frame data (I've forgotten what you called it).
Similarly, change .frm
to match whatever file extension you chose for the frame data file.
You chould probably make things even simpler, by using nix-shell
directly as the interpreter, i.e. instead of bash
. Maybe, the following is possible (I don't have nix
installed, so I can't test it out):
#! /usr/bin/env nix-shell
symbol=$1
start=$2
echo "Retrieving frame for $symbol, starting from $start"
python retrieve-frame.py $symbol $start
echo "Openning retreived data with vd"
vd $symbol.frm
I.e. use nix-shell
, without the double-shebang setup, to initiate each step. As far as I understand, nix-shell
is essentially a bash
-like shell so it should be possible to do things directly like this without using both bash
and nix-shell
(as I did above).
I don't know enough about nix to know what the recommended approach is.
As an aside the double shebang thing does indeed seem to be a nix specific thing: