Issue
Using multiple receivers to monitor HFDL traffic I'd like to create a start script for each of my receivers. The dumphfdl
tool needs quite a few parameters. Besides specific parameters, the frequencies to monitor are given as a set of parameters.
Is it possible to put the frequencies in a text file and so feed them to the script?
Example of command line:
dumphfdl --soapysdr driver=sdrplay --freq-as-squawk \
--sample-rate 2000000 --system-table /home/systable.conf \
--system-table-save /home/systable.conf \
2941 2944 2992 2998 3007 3016 3455 3497 3900 4654 4660 4681 4687 \
--output decoded:basestation:tcp:address=127.0.0.1,port=60011
Desired command line:
dumphfdl --soapysdr driver=sdrplay --freq-as-squawk \
--sample-rate 2000000 --system-table /home/systable.conf \
--system-table-save /home/systable.conf 02M-04M.txt \
--output decoded:basestation:tcp:address=127.0.0.1,port=60011
Solution
The standard solution would be xargs
, but for this particular (and slightly pathological) case perhaps the simplest solution is
dumphfdl --soapysdr driver=sdrplay --freq-as-squawk \
--sample-rate 2000000 --system-table /home/systable.conf \
--system-table-save /home/systable.conf \
$(cat 02M-04M.txt) \
--output decoded:basestation:tcp:address=127.0.0.1,port=60011
... if I can correctly guess what it is that you are actually trying to ask.
The output of the $(command ...)
command substitution is subject to whitespace tokenization and wildcard expansion, but if you have a file which simply contains tokens that you want to insert on the command line (and which don't contain shell wildcard characters etc) this should be reasonably robust and easy to understand.
For more information about the xargs
solution, perhaps see also Linux command output as a parameter of another command
Answered By - tripleee Answer Checked By - Robin (WPSolving Admin)