Skip to main content
Filter by
Sorted by
Tagged with
Best practices
0 votes
1 replies
27 views

We've had troubes in the past trying to validate github environment against unset/empty secrets or variables. I've used bash scripts like [ -z "${{ secrets.mysecret }}" ] && exit 1; ...
some_random_dude's user avatar
Best practices
0 votes
7 replies
91 views

Does Bash support local variables in POSIX mode? x=42 echo $x foo() { local x=43 echo $x } foo echo $x $ /bin/bash4 script 42 43 42 $ /bin/bash4 --posix script ?
Alexander Lubyagin's user avatar
2 votes
6 answers
332 views

My goal is to get a certain number of values between 1 and 50, a certain amount of times. It has to be randomly selected in [1-50] interval. I wrote this script but it runs awefully slow. I removed a ...
Freaka's user avatar
  • 97
2 votes
4 answers
116 views

I seem to be observing conflicting evidence regarding how the tty and the shell share responsibility for displaying user input. In the following interactive session, user input is no longer echoed to ...
merlin2011's user avatar
  • 76.4k
1 vote
1 answer
41 views

i create a script that is supposed to create a new workspace and that workspace launch four terminal each in given position with a command ran in it. this is the script.sh #!/usr/bin/env bash WS='9:...
oumaima's user avatar
  • 49
1 vote
1 answer
58 views

Consider the following expect and bash scripts: spawn-bash.exp #!/usr/bin/env expect spawn bash stty raw -echo log_user 0 remove_nulls 0 expect { -i $spawn_id "?" { send_user -- [...
merlin2011's user avatar
  • 76.4k
-2 votes
0 answers
61 views

I am using regex in GNU bash, version 4.4.23(1)-release (x86_64-pc-msys) (git bash). I am having an issue indicating a colon to the regex. I am looking for the following string: Date : 25 Dolahn(6) ...
Itération 122442's user avatar
3 votes
4 answers
151 views

I am trying to replace elements on an array using a sed command to compare values between two arrays and replace them accordingly, with the following terminal input: #!/bin/bash icons=("" &...
Caio's user avatar
  • 75
1 vote
0 answers
136 views

I wanted to make a CLI tool that will display a random quote (from a list of .sh scripts which show ANSI art along with said quote) and also let you filter by author. It works fine when I pick an ...
petal's user avatar
  • 23
5 votes
3 answers
144 views

When executing a Bash script from PATH, the $0 is set to some string that is equal to the full path of the executable. Consider a script in /tmp/script.sh #!/bin/bash echo "0=$0" echo "...
KamilCuk's user avatar
  • 146k
3 votes
3 answers
180 views

I have the following git alias function that moves files into a directory using git mv of those files and then does the git commit : [alias] mv-into-dir = "!mvIntoDIR() { \ cd ${GIT_PREFIX:-.}; \ ...
SebMa's user avatar
  • 4,965
3 votes
6 answers
174 views

in a bash script I call an external script that gives me the status of a program, like ~/bin/status which returns something like program is running or program is halted Now I want to use only the ...
jokey's user avatar
  • 53
-1 votes
0 answers
37 views

setup host: windows platform git bash Installed meson via python, python -m pip ninja-1.13.0-py3-none-win_amd64.whl/meson-1.9.1-py3-none-any.whl Want to do cross platfom compilation on a windows host ...
stefan's user avatar
  • 1
-1 votes
1 answer
126 views

i cant figure out why there is no visual indication that the python environment is active, i have created the venv with uv, i have installed the flet framework inside it and i can run the python file ...
k1dr0ck's user avatar
  • 1,277
0 votes
0 answers
50 views

I'm trying to manage a huge number of remote repos and I want to clean up the merged branches. I do that with git branch -r --merged HEAD | grep -Ev "(^\*|^+|master|develop)" example output: ...
Jeremy Fiel's user avatar
  • 3,652
0 votes
0 answers
57 views

i lanched an ec2 instance (ubuntu), and i have a script which looks like : #!/bin/bash # works fine (even directly in terminal or via user_data) hostnamectl set-hostname ${hostname} # works fine as ...
Mohamed's user avatar
  • 273
3 votes
3 answers
120 views

I am hoping I can get an answer on this question. I am using ./jq to convert a CSV file into a file of JSON objects. Each line of the CSV input represents a JSON object. A sample of the CSV input is ...
sunpack's user avatar
  • 135
2 votes
3 answers
164 views

This is my main script: #!/bin/bash read -p "Name: " NAME read -p "Age: " AGE read -p "Country: " COUNTRY echo "Your name is $NAME. You are $AGE years old. You ...
Benedix's user avatar
  • 31
1 vote
1 answer
133 views

So I have this really weird issue where I have the following dummy.php script: <?php declare(strict_types=1); $prompt = "Hello there!". PHP_EOL . "What do you want to know?"...
DevelJoe's user avatar
  • 1,552
2 votes
0 answers
103 views

I am learning to replicate an online judge system using Docker to run C code submissions in a sandbox environment. My bash script (running inside the container) is supposed to detect compilation ...
Papazy's user avatar
  • 41
-2 votes
1 answer
107 views

Attempting to solve the "Lonely Integer" problem HackerRank problem statement: My solution declare -i n read n declare -a numbers read numbers n=${#numbers[@]}-1 while [ $n -ge 0 ]; do echo ...
smophos's user avatar
  • 339
3 votes
1 answer
93 views

I am writing a library and would want to detect where from a RETURN trap was called. Kindly consider the following example: #!/bin/bash on_return() { echo "on_return: ${BASH_SOURCE[1]}:${...
KamilCuk's user avatar
  • 146k
0 votes
1 answer
73 views

below is a bash script that works fine tested in my terminal the sound is played but when it is actually ran in a cron scheduled task there is no sound only the dialog is shown #!/bin/bash export ...
k1dr0ck's user avatar
  • 1,277
1 vote
1 answer
101 views

Goal Execute long running command remotely with the following capabilities: We can kill the task with its PID If task completes, its exit code should be written to file Task should be detached from ...
Kungfunk's user avatar
  • 115
1 vote
1 answer
83 views

When I set a DEBUG trap in Bash like this: set -o functrace trap 'echo "# $BASH_COMMAND" >&2' DEBUG Suddenly, this function stopped working: getBase() { local base="$1" ...
Maestro's user avatar
  • 9,846

1
2 3 4 5
3138