<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Scripting on BrainBit Latest Articles</title><link>https://brainbit.uk/tags/scripting/</link><description>Recent content in Scripting on BrainBit Latest Articles</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Tue, 28 Jul 2020 19:23:37 +0000</lastBuildDate><atom:link href="https://brainbit.uk/tags/scripting/index.xml" rel="self" type="application/rss+xml"/><item><title>Bash(and others) things that i use every day</title><link>https://brainbit.uk/posts/bashand-others-things-that-i-use-every-day/</link><pubDate>Tue, 28 Jul 2020 19:23:37 +0000</pubDate><guid>https://brainbit.uk/posts/bashand-others-things-that-i-use-every-day/</guid><description>More and more we embrace bash to do things that maybe in the past we used lower level languages (Dockerfiles , Makefiles , Pipelines etc etc), or at least that’s the way im seeing it , so im leaving some bash little things i user every day:
for loops: for i in $(seq 0 3) ; do echo ${i} ;done for i in {0..3} ; do echo $i ; done for i in &amp;amp;#34;a\nb\nc&amp;amp;#34; ; do echo $i ; done if else oneliners: [[ $( pgrep nginx | wc -c ) &amp;amp;gt; 0 ]] &amp;amp;amp;&amp;amp;amp; echo &amp;amp;#34;nginx running&amp;amp;#34; || echo &amp;amp;#34;nginx running&amp;amp;#34; [[ $( pgrep nginx | wc -c ) &amp;amp;gt; 0 ]] &amp;amp;amp;&amp;amp;amp; echo &amp;amp;#34;nginx running&amp;amp;#34; || { echo &amp;amp;#34;nginx not running&amp;amp;#34; , systemctl start nginx.</description></item><item><title>Quickly JSON.parse() on command line</title><link>https://brainbit.uk/posts/quickly-jsonparse-on-command-line/</link><pubDate>Tue, 30 May 2017 13:16:43 +0000</pubDate><guid>https://brainbit.uk/posts/quickly-jsonparse-on-command-line/</guid><description>I was trying to get some data out of etcd (kubernetes) and i found the value was returned as a string:
you can see the quotes in the beginning, so after playing with sed for a bit , getting me nowhere , i discovered the -r flag of jq so…
As you can see now you have a json object back that we can pass back to jq:
just that.</description></item></channel></rss>