shell - Redirect output parameter of command to variable using bash script -




hello

i developed program 1 can use flags output different kinds of data different files, example:

$ ./program -csv file.csv -log file.log -out out.txt -result result.txt ... 

in case, csv output should saved on file file.csv, log file.log , on. want way save output directly bash variable can use later on script. example:

$ ./program -csv $(write csv_var) \     -log $(write log_var) \     -out $(write out_var) \     -result $(write result_var) \     ... 

as result, want see csv output of program when call echo ${csv_var}. same should happen log_var, out_var, result_var, etc. how can this?

i thought manually creating temporary file each variable, saving output file , reading back, i'm looking cleaner in example above (imagine lot of instances of program running in parallel, files may override others). also, important variable data exists while script running, in "solution" above, if kill script, temporary files / folders continue exist.

thanks in advance





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -