Category "bash"

Bash completion scripting - getting a "transparent proxy"-like behaviour

I am trying to write a simple Bash completion script for a program that runs its arguments as a command. A good example of this is kind of program is the prime-

Counting lines of code in a Django project

I use this shell script to count the lines of code in a Django project, find . -name "*.py" -type f -exec grep . {} \; | wc -l How can I modify this to not c

How to convert a json response into yaml in bash

I read data from a json file with jq. I wanna append the results into a yaml file, but I dont get it working. I am quite new to shell programming. My goal is to

Execute bash script from Python on Windows

I am trying to write a python script that will execute a bash script I have on my Windows machine. Up until now I have been using the Cygwin terminal so executi

rename files with changing pattern

i want to rename different files in bash with pattern and found this option: rename 's/.2007/(2007)/g' *.* with this pattern I can rename every file with "

Gitlab CI/CD - sending comments/alerts to the gitlab UI?

Currently I have this line in my .gitlab-ci.yml file: if (( $coverage < $MIN_COVERAGE )) ; then echo "$coverage% of code coverage below threshold of $MIN_COV

Shortest non-null bash quine

The shortest bash quine is the null string: $ bash -c '' $ What is the shortest non-null bash script which produces its own source code as output?

update value in bash script

i have stuck code. i make bash script to send Notification If file Size changed #!/bin/bash #File Embeded test_file=/home/optimus/bot_test/dump.txt msg_captio

update value in bash script

i have stuck code. i make bash script to send Notification If file Size changed #!/bin/bash #File Embeded test_file=/home/optimus/bot_test/dump.txt msg_captio

How to get information from a while loop after a pipe in bash

From this trivial example: $ x="ls output: " $ ls | while read line; do x="$x $line"; echo $x; done ls output: a ls output: a b ls output: a b c ls output: a b

How do I set a variable to the output of a command in Bash?

I have a pretty simple script that is something like the following: #!/bin/bash VAR1="$1" MOREF='sudo run command against $VAR1 | grep name | cut -c7-' echo

zip error - Nothing to do

I try to zip all folders in given directory. So I wrote this find /home/user/rep/tests/data/archive/* -maxdepth 0 -type d -exec zip -r "{}" \; but got zip e

Get absolut path to tmux.conf in tmux configuration file

I'm desperately trying to extract the absolute path of the tmux.conf file (which is a symbolic link) within the file itself. Usually one can achieve this easily

Why does this script works on one machine but not on the other? MacOS Catalina

I have this shell script which works on my machine just fine. To test the script I have a VM with the same OS Version, MacOSCatalina. On the "real machine" the

Can't start script via screen command

I have a script, and I want to make it work in background after boot. Therefore, I added the command below into rc.local. However, it doesn't work. sudo -iu exe

How to use source command within Jenkins pipeline script

I recently rewrite bash execution command into Jenkins pipeline. The old code is like ... source environment.sh //Build //Test ... Now I use pipeline script

Activating conda environment from bash script

I would like to change my conda environment from a bash script. I want to run bash script_yxz, where 'script_xyz' is like: #!/bin/bash conda activate my_env

Bash: how to unset an env variable with a hyphen (-)?

I have in my environment some variables that have an invalid identifier. When I try to unset them, I get the following error: $ unset A-B bash: unset: `A-B': n

Installing latest docker compose on Ubuntu

I use the following to install the most recent docker compose for my ubuntu server: curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-c

How can I access GitHub Action environment variables within a Bash script run by the Action?

I'm not able to access environment variables defined at the top-level of a GitHub Action configuration file from within a script run by the action. For example