Category "shell"

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

How to read user interaction of rm -I command and store in a variable shell scripting

so this function basically runs similar to rm -i command and the arguments are passed while executing (eg. bash script_Name test.txt). rm -i $file does ask me t

Viewing command history in Google Cloud shell

I am trying to view some commands I used several months ago for a course project. I used the history command but it only showed very recent lines. Is there a wa

Adding platform in flutter engine shell

Any idea on adding new platform to flutter engine (inside shell/platform) like how samsung did for tizen Any documentations or suggestions please.

Script to create swap partition fails when running automatically

I am creating a cluster of machines in AWS (Amazon Linux 2) using terraform by utilizing the user_data argument under the aws_instance resource. Part of the scr

Pass parameter from list in file

i'm struggling with this topic: I've a file with a list of IDs, something like this: 34 23 478 12579 342356 On the other side, i've a command that i want to ru