Category "bash"

Should PATH contain directories or full paths to binaries?

I am trying to set up a correct PATH, but I'm wondering what it should contain. If I have /usr/bin/ls /usr/local/bin/ls and I want to prefer the one in /usr/

Grep sorting dates [closed]

Each day I have to manually identify each stuck call by looking for calls with a date older than the current day. I have managed to grep the r

How can I combine AWS EC2 describe-instances with describe-image?

I have 2 API calls, the second uses AMI-ID from the first aws ec2 describe-instances \ --query "Reservations[*].{ \ OWNERID:OwnerId, \ IP:In

Bash sed command issue

I'm trying to further parse an output file I generated using an additional grep command. The code that I'm currently using is: ##!/bin/bash # fetches the links

Bash script to test website status, then run command

I am trying to write a very basic bash script, to run on a linux server. I am not sure why it's not working. The intention is to test if a website returns a 200

how to use first processor input/output in last processor of flow in apache NIFI without storing files/DB

I have 5 processors processor1( have a value)=>processor2( have b value) => processor3(calculate c=a+b)=>processor4( calculate d=c*a)=>processor5( c

issues with spawn id <idx> not open when executing script from iTerm2

I am trying to write a script and execute under iTerm2 profile. However whenever I open the new tab i run into this error. but I execute the same script on Term

How to create passwordfile with env variables

In my Programm how can i Iterate trough ENV in bash if [ ! -z $USER_1 ] then echo "$USER_1":$(openssl passwd -apr1 $PASS_1) > ./passwords fi if [ ! -z $USE

Pass build argument to bash command in Dockerfile

Currently, my workflow is to use an alias for the jupyter lab command via RUN echo 'alias...' at the end of my Dockerfile: RUN echo 'alias jupyterlab="jupyter l

How to stop auto-generation of log files by cron?

I have a bot on Marathi language wikipedia. The bot runs from Wikimedi's toolforge server. I have set up a cron job which generates two files: one .err and anot

Catch return code from composer validate in bash script

I'm trying to write a bash script that validates that composer.lock is up to date with composer.json before attempting to run composer install. I have tried som

Failing script as process substitution not working in Dart

Is there any way to make the script: diff <(echo 'hello') <(echo 'hello-2') work, as currently it fails with error in Dart when run using Process.run or P

How do I use bash commands to merge two separate GitHub branches (each several commits ahead of the main) into the main branch?

As part of my graduate research, I collect field data that gets entered into CSV files daily. I have all my data within a private GitHub repository. My technici

How to properly pass filenames with spaces with $* from xargs to sed via sh?

Disclaimer: this happens on macOS (Big Sur); more info about the context below. I have to write (almost did) a script which will replace images URLs in big text

Capture nth field bash

I have data in a file test.txt in below format. abc,123,mno,xyz,1234 mno,123,abc,rpt,pqr,2345 xyz,456,uyt,rtp,rto, I want to capture the 3rd field which I am a

Git diff command from shell script

I have a script: #!/bin/bash git log -1 | grep -w '^commit' | cut -d ' ' -f2 | git show | grep -w '^index' | cut -d ' ' -f2 > tmp_out while read -r arg do

bash output with extra newline within the string

I use the following command to output PID and FD related to CLOSE-WAIT sockets. sudo ss -p | grep CLOSE-WAIT | awk '{ print $7 }' | sed 's/,pid=/ /' | sed 's/,f

How to create a new postgresql database via ubuntu shell

I’m doing; createdb -O dan -h 127.0.1.1 -p 5432 -U dan -w testdb but it throws me: fe_sendauth: no password supplied Then I tried to remove -w and it a

How to create random pass names in ffmpeg?

Normally, when using ffmpeg, you define a name for the "pass" information to be stored in a file when enconding videos with 2 (or more) passes, e.g.: ffmpeg -i

Find patterns from one file in another file

I'm trying to find patterns from one file in another file. The pattern in file one looks something like this: ENSG00000203875.13 ENSG00000262691.1 ENSG000002549