I would like to have a csh script to test a variable between two pipes. For example (the incoming resembles a json file but without the newlines and indentations):
set debug = 1
cat test.inp | if ($debug) then (jq '.response' | tee test2.json) else python -m json.tool endif > test.output
The idea is that whatever the value of the variable debug, the output is saved in
test.output
. But the way I wrote this leads to the error:
> if: Improper then.
Is there any way to do this in csh/tcsh (as there seems to be in sh/bash)?
Asked by gammarayon
(1 rep)
Dec 30, 2019, 02:02 PM
Last activity: Oct 30, 2023, 10:03 PM
Last activity: Oct 30, 2023, 10:03 PM