(directory=$(python -c 'import read_params; print(read_params.get_directory())')
nsrc=$(cat $directory/master.pixels|wc -l)
tail $directory/forward_src0{1..$nsrc}_ls00/out_data_forward)
What the above does is that a simulation is running (what that is is not important) and the above command tracks it, by printing out the files in the directory:
- ..../forward_src01_ls01/out_data_forward
- ..../forward_src01_ls02/out_data_forward
- ..../forward_src01_ls03/out_data_forward
- ..../forward_src01_ls04/out_data_forward
and so on till src_08.
It runs in some linux systems without error. But in my system, it throws the below error:
[prasad@daahpc1 sparc_flows]$ (directory=$(python -c 'import read_params; print(read_params.get_directory())')
> nsrc=$(cat $directory/master.pixels|wc -l)
> tail $directory/forward_src0{1..$nsrc}_ls00/out_data_forward)
tail: cannot open /scratch/prasad/sparc_test/forward_src0{1..8}_ls00/out_data_forward' for reading: No such file or directory
To be clear, these files do exist... I can open them individually, but not in a batch.
{1..$nsrc}
. The system you are using where this works may be usingksh93
orzsh
, but it would not bebash
.