Category "shell"

How to read do not disturb using applescript?

I am trying to read status of do not disturb or dnd using applescript. For some reason, it always return "1" no matter what if the dnd is on or off. do shell sc

How to pass passphrase of ssh in bash script? [duplicate]

I am discovering the bash scripting. I need to write a bash script to automatically connects my remote server with ssh. I am using MACOSX. I w

How to make a developed perl package with a python wrapper callable from everywhere

A bit of context: I have a Perl parser, named parse_log.pl, that parses logs into a .m file (MATLAB function). In the .m file, the logs are stored into a MATLAB

Shell script within .app bundle errors out

I use a shell script named myapp.command to open an app such as the Microsoft PowerShell app: #!/bin/sh exec /usr/local/microsoft/powershell/7/pwsh The script

simulating '<' operator in a c programme

I am recreating a complete shell. For that I must simulate <. To do this, I have to use the function dup2(). I made this but it didn't work and I donc't unde

Pentaho data integration, Move Files ERROR: Could not rename file

I'm running a job with Pentaho Data Integration 8.1, I retrieve a file frop ftp, work on it and move it to a folder. I tried, as I did many other times with no

Python Socket Listener error with connecting to bash reverse shell - `bash: cannot set terminal process group (1057): Inappropriate ioctl for device`

Python Socket Listener error with connecting to bash reverse shell - bash: cannot set terminal process group (1057): Inappropriate ioctl for device I am workin

shell read seems to be getting newlines from file (fifo or regular)

What I want to achieve is to have a shell script hooked up onto a fifo and react to certain commands that would read out (with the usual read command). Now this

Not able to assign value to variable$i in shell script

abc=( "one" "two" "three" ) for((i=0; i<${#abc[@]}; i++)) { xyz$i="hello" --- this is giving me error as no such file or directory eval xyz$i="hel

Run shell script which is on hdfs location from a pyspark script

I have a requirement where i have to run call a shell script which is on hdfs location and run the shell script from a pyspark script. My code is something like

Regular expression to capture alphanumeric string only in shell

Trying to write the regex to capture the given alphanumeric values but its also capturing other numeric values. What should be the correct way to get the desire

Appending values to existing values of environment variables in go

How can I append another value to an existing value of a go environment variable? If CGO_CXXFLAGS has the value "-I/blah/blah" Since the following doesn't work

Packer unable to read shell script while using Docker plugin

I am trying to create a docker image using Packer. However, when I am trying to use the shell provisioner it is unable to find the shell script. learn-packer.do

Update global variable from while loop

Having trouble updating my global variable in this shell script. I have read that the variables inside the loops run on a sub shell. Can someone clarify how thi

Count character difference between two files in bash

What would be the best way to count the number of characters that are different between strings in two files. I know how to do this in Python but I need a bash

Bash program that returns 1 on input and 0 otherwise

Is there a standard linux terminal program that when given text input (in standard in) returns a 1 and 0 if no text is provided? (The reverse logic would also b

How to error handling curl and mysql in python subprocess.run()

I have python script which uses subprocess.run() getting dump file by curl and input dump file by mysql cmd = "curl {0}/{1} -o /tmp/{2}".format(dir_name,file_na

How to write the regex to capture alphanumeric value between square brackets?

Please help in writing the regular expression for below line in bash. There are muliple lines like this in my file, and I want to only capture the below values

Running shell command that has nested quotes via ssh

I have this following shell command: ssh user@host "df | grep /dev/ | \ awk 'BEGIN{print "DISK", "%USAGE", "STATUS"} {split($5, a, "%"); \ var="GREEN"; print $

How do you use mktemp to create directory in Makefile?

This is a Makefile piece of code of how someone may use mktemp in a Makefile TEST=$(shell mktemp -d) mktemp: echo $(TEST) touch $(TEST)/test.txt ls