shell

How to emit result in Tekton with python script?

How to emit result in Tekton with python script? Question: I my Tekton pipeline I want to emit a result so that $(results.myresult) can be used in the next pipeline task. The code looks like this: apiVersion: tekton.dev/v1beta1 kind: Task name: foo namespace: bar … spec: results: – name: myresult script: | #!/usr/bin/env bash # …

Total answers: 2

python subprocess.call() doesn't work with multiline shell commands

python subprocess.call() doesn't work with multiline shell commands Question: I would like to run this multiline shell commands: echo ‘a=?’ read a echo "a=$a" from a python script, using the subprocess.call() method. I wrote this, in test.py file: import shlex, subprocess args = ["echo", ‘a=?’,"read", "a", "echo", "a=$a"] subprocess.call(args) and when I execute it, I …

Total answers: 1

UnicodeDecodeError in client server communication when accessing Desktop

UnicodeDecodeError in client server communication when accessing Desktop Question: I want to write a reverse shell like netcat. Everything works fine, but after several commands typed in, the client machine throws an error. I managed to identify the problem. When I change to the Desktop directory on the server, for example C:/Users/Desktop and I type …

Total answers: 1

running subprocess with combined cd and pwd

running subprocess with combined cd and pwd Question: I run subprocess in jupyter to get the core path. I have to go one folder up and then call pwd Running: import subprocess mypath=subprocess.run("(cd .. && pwd)") leads to a "No such file or directory: ‘(cd .. && pwd)’ error. I guess the cd calls a …

Total answers: 3

`conda info` points to a different base path while called from within Python

`conda info` points to a different base path while called from within Python Question: I have observed a strange behaviour: In my shell I activate a conda environment abc with conda activate abc. I run conda info –base and obtain a proper path where I installed conda, I get: $HOME/miniconda3. I start a python interpreter …

Total answers: 1

Run flask application on linux server with nohup

Run flask application on linux server with nohup Question: I am trying to run my flask application on my linux server using nohup , but each time i run my flask application with nohup , my server will require me to kill with cntrl + c in order for me to do other things assuming …

Total answers: 1

Using Python to start shell but wont interrupt original script

Using Python to start shell but wont interrupt original script Question: So I have a "master" python script which should be able to execute different shell scripts and not get stuck in the shell loops. import socket import subprocess UDP_IP = "192.168.50.3" UDP_PORT = 5005 sock = socket.socket(socket.AF_INET, # Internet socket.SOCK_DGRAM) # UDP sock.bind((UDP_IP, UDP_PORT)) …

Total answers: 1

Best way to output concurrent task results in shell on the go

Best way to output concurrent task results in shell on the go Question: That is maybe a very basic question, and I can think of solutions, but I wondered if there is a more elegant one I don’t know of (quick googling didn’t bring anything useful). I wrote a script to communicate to a remote …

Total answers: 1

lines with matches as a new column

lines with matches as a new column Question: I have a file: Position1 Val1 Val2 Val3 Position2 Val4 Val10 Val5 Position3 Val20 Val200 and I would like to move the line with the word "Position" as a new column, tab separated: Val1tPosition1 Val2tPosition1 Val3tPosition1 Val4tPosition2 Val10tPosition2 Val5tPosition2 Val20tPosition3 Val200tPosition3 Val vary in quantity, so Position(s) …

Total answers: 2