Create a bash command that takes json file as a argument -


i have bash command sendtransact send transaction server. transaction available in different json file. need able like:

$ sendtransact <filename.json> 

which appends contents of <filename.json> sendtransact.

sendtransact:

sendtransaction(){     echo $1 | \         http --verbose  post "http://localhost:8081/v1.1/payments?provide_explanations=true" \         | cat $0 } 

sendtransaction

you'll want pipe it. either...

cat file.json | sendtransact 

or...

sendtransact < file.json 

(they same thing)

you'll have make sure sendtransact supports parsing stdin input not programs do. constructed programs do. if instead command uses parameter , reads input, may need like...

sendtransact -f file.json 

Comments