From: Nicolas Boisselier Date: Tue, 7 Feb 2017 23:55:35 +0000 (+0000) Subject: cat if jq not found X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=2280ab97ad79127be25a6777029f4a7d64041a29;p=nb.git cat if jq not found --- diff --git a/bin/ovh-api b/bin/ovh-api index 41a18ce0..a2fb4d67 100755 --- a/bin/ovh-api +++ b/bin/ovh-api @@ -62,7 +62,7 @@ if (@ARGV and $ARGV[0] =~ /^(\w+):(\w+)(?::(\w+))?$/) { } @KEY or help(); -open STDOUT,'| jq .' if $Opt{jq}; +open STDOUT,'| (which jq > /dev/null && jq . || cat)' if $Opt{jq}; my $Api = OvhApi->new(type => OvhApi::OVH_API_EU, applicationKey => $KEY[0], applicationSecret => $KEY[1], consumerKey => $KEY[2]); # Auth