I am trying to create shell script that ssh into a remote server and run a script there and print the output in the local server but when I run the script in the local server it most of the time outputs nothing and rarely outputs data : and when I ssh in the local server to the remote server
Tag: bash
Unable to get the absolute value of command output
So I wanted to make a simple script to keep checking the CPU temperature of my RasPi, which is stored in /sys/class/thermal/thermal_zone0/temp , and hence cat /sys/class/thermal/thermal_zone0/temp would give the temp, but like this : which essentially means 38.459 degree Celsius. I was unable to format the ou…
conditionally merge files by appending in bash
I have two files and would like to merge them – by appending to the last line. file1.txt content file2.txt content Desired outcome – file3.txt How do I go about this, please? Note, zero is in place for null in the Stack line. Answer Using awk: When file2.txt is read, store field2 in array a using …
How do I add a numbered suffix at the end of my files using split on Linux BASH?
I’m using the split command in a Macbook and instead of getting numbers, I’m getting files such as output_aa, output_ab, output_ac, and what I need is output_1 , output_2, output_3, and so on. Here’s the code I’m using, it’s on a .txt of a book (Harry Potter) and I’m trying…
Shell : create and assign variables inside for loop
i ve this shell script ; it’s a loop which set in the variable “a” each time result : My Purpose is how to change “a” by a dynamic variable name which be $item_MYPREFIX (concatination :$item + _MYPREFIX ) So that my code would be generic , something like this : and i would be abl…
Why does SIGHUP not work on busybox sh in an Alpine Docker container?
Sending SIGHUP with to a busybox sh process on my native system works as expected and the shell hangs up. However, if I use docker kill to send the signal to a container with it doesn’t do anything. The Alpine container is still running: By the way, with an Ubuntu container (which runs bash) it does wor…
kubectl exec behaving strangely, stating command not found even though the binary is there in the pod
So have an OpenShift cluster and running a pod in the mongodb-test namespace. The pod is running fine When I exec into the pod and run the mongo command, I dont get any issue and the command works as expected. Now the problem is when I try to run the same command using below syntax I get mongo not found
How to find all symlinks to a file?
This is my hierarchy: l1 and l2 are symlinks to a.txt. I run this code to find all symlinks to a.txt in the /aaaaaaaa: And it obviously doesn’t work, cause I must compare realpath of file with path of a.txt. In what way I should do this? Answer If you have GNU/BSD find just use -samefile primary.
Extract all unique URL from log with only POST type of the request
I’ve got a log file with the such type of the records: 41.201.181.27 – [2019-04-06 18:22:02] “GET /images/stands/photo_mois.jpg HTTP/1.1” 304 – “http://example.com/popup.php?choix=mois” “Mozilla/4.0” “-” I’ve got the script for getting al…
How to pass parameter of oracle sql script file to sqlplus from shell prompt?
Objective: To invoke sqlplus with sql script file path as parameter from shell prompt Scenario: logged in as root and would like to execute the sql script file as oracle Command: Expected: sql commands in createschema.sql are to be executed Actual: getting only sql prompt Also, tried: a) b) whenever sqlerror …