<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Linux | Breek Een Been</title>
    <link>https://blog.breekeenbeen.nl/category/linux/</link>
      <atom:link href="https://blog.breekeenbeen.nl/category/linux/index.xml" rel="self" type="application/rss+xml" />
    <description>Linux</description>
    <generator>Source Themes Academic (https://sourcethemes.com/academic/)</generator><language>en-us</language><copyright>Rob Maas</copyright><lastBuildDate>Tue, 19 Apr 2011 13:41:31 +0200</lastBuildDate>
    <image>
      <url>https://blog.breekeenbeen.nl/images/icon_hue0c3a5851739ca8a2afc787728ee763e_182872_512x512_fill_lanczos_center_3.png</url>
      <title>Linux</title>
      <link>https://blog.breekeenbeen.nl/category/linux/</link>
    </image>
    
    <item>
      <title>Executing Bash Scripts Withinfrom Powershell</title>
      <link>https://blog.breekeenbeen.nl/post/executing-bash-scripts-withinfrom-powershell/</link>
      <pubDate>Tue, 19 Apr 2011 13:41:31 +0200</pubDate>
      <guid>https://blog.breekeenbeen.nl/post/executing-bash-scripts-withinfrom-powershell/</guid>
      <description>&lt;p&gt;Sometimes you have processes which use multiple systems and if you are real lucky they cover multiple OS flavors, in this case I had a process which needs to make changes on Windows and Linux servers. Since Powershell was relatively new to me, I thought why not start with that. The Windows part was easily covered, but the Linux part, well euhm, takes a bit more effort. Unfortunately it is not possible (at least I don’t know how) to execute commands directly from Powershell within the Linux servers, so we had to create a workaround. It is easy to do this with the help of “
&lt;a href=&#34;http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;plink&lt;/a&gt;”, plink is a backend tool for Putty and makes it possible to run SSH commands on a command line bases. Now we have tool which can execute commands through SSH within a Linux machine, it is relatively easy :-) See the example below. The bash script (helloworld.sh) which we want to execute:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-shell&#34;&gt;#!/bin/bash

function helloworld(){
  for i in {0..9}
    do
      echo &amp;quot;Hello World!&amp;quot;;
    done
}
helloworld;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The Powershell script (testbash.ps1) which executes the bash script:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-powershell&#34;&gt;#Invoke-Expression -Command &amp;quot;&amp;amp; &#39;C:Program Files (x86)PuTTYplink.exe&#39; root@server ~/helloworld.sh&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
</description>
    </item>
    
  </channel>
</rss>
