Category "bash"

AWS CLI - Create script to add my IP to security group

I'm trying to create a script to add my IP adress to AWS VPC security groups somthing like > aws ec2 modify-security-group-rules --group-id GROUPID\ > --

Parallel subshells doing work and report status

I am trying to do work in all subfolders in parallel and describe a status per folder once it is done in bash. suppose I have a work function which can return a

bash oneliner search for files and dump name and content into new file

as title says I need to write a bash oneliner that finds all txt files and, for each, writes name and content into another file. So far I wrote: find . -name "*

Bash script: read 30000 records from file and run multiple process in parallel

txt with more than 30000 records. All records are one for line and is an IP like this: 192.168.0.1 192.168.0.2 192.168.0.3 192.168.0.4 192.168.0.5 192.168.0.6 1

Sed: specific exact two match

I have this line in a file. The blanks between the words can be tabs or spaces #define FN_AUTO_FN_FNSECTOR Function(2) /* FN_ comment*/ and I wanted outp

In bash, replace each character of a string with a fixed character ("blank out" a string)

MWE: caption() { echo "$@" echo "$@" | sed 's/./-/g' # -> SC2001 } caption "$@" I'd like to use parameter expansion in order to get rid of the she

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:]

batch rename matching files using 1st field to replace and 2nd as search criteria

I have a very large selection of files eg. foo_de.vtt, foo_en.vtt, foo_es.vtt, foo_fr.vtt, foo_pt.vtt, baa_de.vtt, baa_en.vtt, baa_es.vtt, baa_fr.vtt, baa_pt.vt

How to run Fluent-Bit in AWS-Lambda

I have built a more simple test image that works. The Dockerfile installs python, then Fluent-Bit, and then the CMD is a shell script that starts both processes

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

jq - return array value if its length is not null

I have a report.json generated by a gitlab pipeline. It looks like: {"version":"14.0.4","vulnerabilities":[{"id":"64e69d1185ecc48a1943141dcb6dbd628548e725f7cef7

How to run program in Bash script for as long as other program runs in parallel?

I have two programs server and client. server terminates after an unknown duration. I want to run client in parallel to server (both from the same Bash script)

Script linux loop for multiple number

I have a list of Linux commands that I need to repeat up to 670. How can I automate the commands, so I don't have to do the 670 times. I don't know how to do al

How to expand variable inside EOF tag

I have a bash script below : #!/bin/sh set -e go mod init broken_env built_at=`date -u "+%d-%m-%y@%H"` cat > main.go <<'EOF' package main import (

Git bash on Windows different result than terminal on CentOS for regex [duplicate]

See the following cleanCustomer.sh file #!/bin/bash customer=Reportçós cleanedCustomer=${customer//[^a-zA-Z0-9 \-_.]/} echo $cle

Problem running COMSOL in a cluster with SLURM

I am trying to upload this job via a .sh script to a cluster with SLURM, using the COMSOL software: #!/bin/bash #SBATCH --job-name=my_work #SBATCH --nodes=1

How to manage audio in and out from and to file of Huawei GSM modems?

I've got a Huawei E173 USB dongle connected to a Raspberry PI. I'm trying to use the device to make and receive calls. For my purpose, it is needed (i) to save

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