mysql output in html table- shell script

Bash
I am executing one mysql query returning two columns in shell script TABLES=$($MYSQL -u $MUSER -p$MPASS -h $MHOST $MDB -e "SELECT table_name, ROUND((...
1 year ago

Bash script to get into a running container and then run another bash script from that container

Bash
I have a shell script which runs as follows : image_id=$(docker ps -a | grep postgres | awk -F' ' '{print $1}') full_id=$(docker ps -a --no-trunc -q...
1 year ago

check if string match a regex in BASH Shell script

Bash
One of the arguments that my script receives is a date in the following format: yyyymmmdd. I want to check if I get a valid date as an input. How ca...
1 year ago

Automatically chdir to vagrant directory upon "vagrant ssh"

Bash
So, I've got a bunch of vagrant VMs running some flavor of Linux (centos, ubuntu, whatever). I would like to automatically ensure that a "vagrant ssh"...
1 year ago

How to call script on tuple in shellbolt

Bash
First day playing around with storm in Java so appreciate any help -- I'd like to call a Python script in a bolt in order to do some calculations. Thi...
1 year ago

How do I activate a virtualenv inside PyCharm's terminal?

Bash
I've set up PyCharm, created my virtualenv (either through the virtual env command, or directly in PyCharm) and activated that environment as my Inter...
1 year ago

Running Grunt from OSX Automator shell script

Bash
I have a simple Gruntfile that I want to be able to run from an icon in my OSX dock. I have created a very simple shell script (launcher.sh) that I w...
1 year ago

sed removes one string in one file

Bash
I'm trying to remove one string in one file by using: sed -i -e '/example/' test.txt But I've got the following error: sed: -e expression #1, ch...
1 year ago

Reuse matched pattern in inserted or appended line with GNU sed

Bash
I am trying to insert (resp. append) a line before (resp. after) a pattern with sed. Maybe awk would be simpler but I am not familiar with it. Here i...
1 year ago

Shell/bash script for invoking curl

Bash
I need to invoke a Rest api call if i encounter a fail in a field in CSV file: I have a CSV file, which looks as follows: project api_name ...
1 year ago

bash hiding default stderr code and replacing it with my own

Bash
When I use ping foo.com I either get a response or ping: unknown host foo.com I am using this script to show custom responses status=$(ping -c 1 f...
1 year ago

Unknown option to s when trying to replace line with #

Bash
In a bash script, I'm trying to replace a line which starts with a comment with new text. The sed fails telling me that the hash char is an Unknown op...
1 year ago

Shell script can't use logical or with find command

Bash
I have a script that deletes *.log or *.txt files either more than 10 MB or more than 15 days old. I wrote the code but cannot put -or between *log an...
1 year ago

return regex result from cmd output to variable

Bash
I'm looking forward to get a string from an cmd output (ID of tmutil destinationinfo). I have tested this regex with https://regex101.com/r/aI3yH2/1:...
1 year ago

Moving shell code to a function causes it to stop functioning: "no such file or directory"

Bash
I'm writing one of my first bash scripts that analyses a text document with different regex expressions. The following command does exactly what it's ...
1 year ago

How to send BOOT_COMPLETED broadcast to ONLY your app

Bash
This is what I've been trying to do in order to send BOOT_COMPLETED broadcast to my app ONLY: adb shell am broadcast -a android.intent.action.BOOT_CO...
1 year ago

Shell written in C executes only one time

Bash
I am asked to write a code in C for a shell, that will execute orders like ls, pwd, ls -l, ls -l -la, ls -l /tmp, etc. without pipes. Here is how it ...
1 year ago

How to execute multiple command after double pipes in shell script

Bash
I am writing a Korn shell script where I have a function like this #!/bin/ksh myfunc() { some_command1 || return 1 some_command2 || return 1 ...
1 year ago

How do I get the network mask in Linux

Bash
I am trying to get the network mask using bash in that way: 192.168.1.0/x I tried with: ip -o -f inet addr show | awk '/scope global/ {print $4}'...
1 year ago

Finding the most edited files in all history of a Mercurial repository

Bash
From the command line, how can I get a list of the most edited files in all history of a Mercurial repository?
1 year ago