Skip to content
Advertisement

Tag: bash

run a crontab job using an anaconda env

I want to have a cron job execute a python script using an already existing anaconda python environment called my_env. The only thing I can think to do is have the cron job run a script called my_script.bash which in turn activates the env and then runs the python script. Trying to execute this script from the command lines doesn’t

git-p4 message and author encoding

today i am in the position to migrate some pretty old perforce repositories to git. While this is realy interesting there is one thing that caught my eye. All special characters in the commit messages and even the author names are not in the correct encoding. So i tried to investigate where the problem comes from. first of all the

How to insert a python program into a bash script?

I have a small python program that parses a text file and writes the output to another file. Currently, I am writing a bash script to call this program several times, it looks something like: This works fine but I want to know if it is possible to have the python program inside the bash script file so when another

piping from stdin to a python code in a bash script

I have a bash script, f, that contains python code. That python code reads from standard input. I want to be able to call my bash script as follows: In the example above, the python code will read from input.txt and will write to output.txt. I’m not sure how to do this. I know that if I wanted to just

Fast hash for strings

I have a set of ASCII strings, let’s say they are file paths. They could be both short and quite long. I’m looking for an algorithm that could calculate hash of such a strings and this hash will be also a string, but will have a fixed length, like youtube video ids: MD5 seems to be what I need, but

running multiple bash commands with subprocess

If I run echo a; echo b in bash the result will be that both commands are run. However if I use subprocess then the first command is run, printing out the whole of the rest of the line. The code below echos a; echo b instead of a b, how do I get it to run both commands? Answer

Advertisement