Category "shell"

shell-command never returns in emacs lisp

I am trying to write a function to send the clipped image in windows host to my Ubuntu WSL2 (defun win2wsl-clipped-image() "use powershell to save the

How to convert ouput into uppercases in kali linux shell

I need to convert from 'ifconfig' command output to Uppercases: I've tried like this: ifconfig | tr [:upper:]

How can I truncate a line of text longer than a given length?

How would you go about removing everything after x number of characters? For example, cut everything after 15 characters and add ... to it. This is an example s

How to add a PWD in to .env

Is there anyway to use pwd or $PWD in .env. Im looking to get the PWD so that I can add it to an PYTHONPATH env. Thanks,

Bash IF condition with multiple conditions not giving proper result

Trying to fetch the status of the URL for sonarqube quality gate and check if the status is "OK" the condition should pass or if the status is "ERROR" then it s

Bash loop trough all users to delete password hints

I have newly started with bash and now I am facing the following problem: lukas@Lukass-MacBook-Pro Desktop % ./script.sh delete: Invalid Path <dscl_cmd> D

Passing quoted argument in json payload to shell script

I am working on a python script that passes arguments to a shell script that lives in a Docker container. I'm achieving this using this Go webhook tool (https:/

Get homebrew to run a script after 'brew install x' or 'brew uninstall x'

I want to automate having a file that tracks all my installed brew packages. I can do this manually with brew list > somefile, how ever I want this process t

How to add Multiple user acccount with check and SSH key using Bash script

Based on my requirement in my dev server, I have Created a Linux function that will create a dev user,(Take the user's first name and create a Linux user ) we h

Import functions that use ipython magic

In ipython cells you can execute shell commands as follows: ipython: print("asdf") !echo asdf However, if you try to import this code from file, asdf.py: def a

Data extraction from array using jq

Please help me to figure that one out... I want to get the ID where the name is - terraform-02 jq '.[] | map(select(.name == "terraform-02"))' - didn't work, to

How to store line by line in a variable?

I want to search for hidden directories or files with "find" and store it in a variable. I tried like this and it works, but it is stored one after one in TEST.

grep for a pattern "variable=value" and returning only matching entries having a value > threshold

I am searching a kubernetes pod logs for the pattern “variable=value” ( e.g., variable=10 or variable=500) using the command below: Kubectl logs -f

how to print prime numbers using for loop in shell script

I want to print prime numbers using for loop in shell script. Please provide some suggestions. actually I could able to print odd numbers from range of 1 to 10

how to autoinput in bash scripting

I'm tired to put username in this input by bash script i run the script but what shall i do when i rich to this line its expecting to input username Vpn.sh: 1:

how to autoinput in bash scripting

I'm tired to put username in this input by bash script i run the script but what shall i do when i rich to this line its expecting to input username Vpn.sh: 1:

How to get latest file from sftp server to local using mget in linux?

Hi I am following below logic to get the latest file from sftp server. But it is copying all the files. Please help what I need to correct in my logic? datadir=

Linux getenv() could not get $PS1 or $PS2

My home world is to write a shell. and I must use $PS2. but when I write a code like this: char *ENV_ps2; ENV_ps2 = getenv("PS2"); I just found ENV_ps2 was

How to undo extracted files by 7z

I was trying to install aws cli. I executed the following command curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" It downloade

How to pick words in a log file using shell script

I am trying to pick words start with "Approved by" and end with after "AAAA" letters . here is log file. Test worker] INFO cyyom.bghhht.gsghhj.dijjkkgital.dggcf