Skip to content

Tag: bash

Multiple strings to one string comparison bash

I have a shell script like below. It works based on a condition that if $table contains test then executes small.sh, elde big.sh. Now I want to check if tables contains test , _test_and_results and success in if [[ “$table” =~ “test” ]]. How can I do that I have tried like below But wh…

Preventing background process from writing to console

In Linux’s bash, I know how to start a long running process and send it to the background. For example run.sh, then press Control+Z, then type bg 1 Sometime I would like to continue do other work, but this background process keep printing to my Putty console – which is annoying. I know I can start…

Linux Terminal Two Conditions to check

I need to check if node is running and if file /root/app/application.js exists and return corresponding message in terminal… For checking if node is running or not i do this and this works: Now i need to add to this to check also if file not exists /root/app/application.js so i found that this command i…

How to access python return value from bash script

I’m trying to understand how to access from a bash script the return value of a python script. Clarifying through an example: foo.py start.sh If I run the bash script, this prints the message “exec main..”. How can I store in script_output the return value (execution ok)? If I direct executi…