Skip to main content
Filter by
Sorted by
Tagged with
3 votes
1 answer
93 views

Here is a bash script: #!/bin/bash char=$'\x01' if [[ "$char" =~ ^[\x01-\x20\x7F-\xFF]$ ]] then echo "Unprintable" else echo "Printable" fi The script ought to say ...
Melab's user avatar
  • 2,966
1 vote
0 answers
46 views

I downloaded Fedora 43 Cosmic (Wayland) and found no way to disable my touchpad (mouse is always connected). xinput and synclient seem to be X11 only. Touchpad Disable is a simple checkbox with KDE ...
One Dash Dot compact web's user avatar
0 votes
0 answers
35 views

I have a bash script that I use to gather the usage stats of my storage volumes and email myself the results. Done so I can keep an eye on unexpected changes in disk usage. The relevant code that ...
NAS Box's user avatar
1 vote
2 answers
47 views

I have the following script, which should read the output from another command and then wait for changes, syncing these to a target directory. I replaced the actual commands with sleep and cat to make ...
Mischael Schill's user avatar
Advice
0 votes
2 replies
32 views

My question is not about how to use nohup to redirect output. I've been using it for a while. Let me first state that I use bash. I know that by default, nohup my_command redirects stdout and stderr ...
potim's user avatar
  • 11
0 votes
2 answers
52 views

Suppose my current activated conda environment is py314 on Linux. When I start a new bash environment from the current one, no matter via command bash, screen, or start vscode from command line, the ...
link89's user avatar
  • 1,979
0 votes
0 answers
57 views

I'm trying to translate my bash scripts using the gettext tools but I have a problem where the encoding seems to be wrong. Let's say I have the following file called fr.po: # French translations for ...
Elie G.'s user avatar
  • 1,784
0 votes
1 answer
89 views

I am attempting to compile and run a Fortran 90 program using command line (bash). In the past, when I've run gfortran /path/to/file, a file a.out and a file program_name are created, and I can run ...
JDoe's user avatar
  • 11
Best practices
0 votes
0 replies
38 views

I was trying to exercise with Bazel by packaging a deb package from a collection of scripts I'm writing to automate a few tasks at work. Right now, I keep them either in /usr/local/bin or \~/.local/...
Alessandro Bertulli's user avatar
Best practices
0 votes
1 replies
32 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
1 vote
0 answers
74 views

I have a high memory program (ML) that I want to run in a tmux session. However, if the process is OOM killed, the tmux session is also shut down. I partially solved it (using the below run-bg), but ...
Awes's user avatar
  • 41
Best practices
0 votes
7 replies
113 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
-3 votes
0 answers
46 views

Encountering an issue where the access token is not generated at the intended instance when using a Linux VM with system-assigned managed identity to retrieve secrets from Azure Key Vault. This issue ...
Shruti Salunkhe's user avatar
2 votes
6 answers
401 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
4 votes
4 answers
118 views

How can I map an unknown value alongside other known values in bash using an associative array, so that: #!/bin/bash array=("foo" "foo" "bar" "something else" &...
Caio's user avatar
  • 75
2 votes
4 answers
131 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.5k
0 votes
2 answers
34 views

I have installed Firebase CLI on my Windows OS machine, I have activated FlutterFire CLI, and have added Dart’s global bin to my system PATH But when I run flutterfire --version command in my bash ...
JAMES's user avatar
  • 11
2 votes
1 answer
43 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
  • 69
2 votes
1 answer
88 views

I have a bash script that turns off stdout and stderr when not run interactively (i.e. run from CRON). if [[ ! -t 0 && ! -t 1 ]]; then #echo "The script is not called ...
ballatom's user avatar
  • 209
1 vote
1 answer
61 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.5k
1 vote
1 answer
83 views

I have a yaml file with an arbitrary amount of documents, and I'm trying to replace all missing namespaces for namespaceable resources with an arbitrary input one. Getting the non-namespaceable ...
Some Guy's user avatar
  • 809
-2 votes
0 answers
63 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
2 votes
2 answers
119 views

I'm trying to write a small bash script that will take values from my mouse's horizontal scroll wheel to change my system's volume. Using this guide, I've come up with the following command to ...
SodaIsSoda's user avatar
3 votes
4 answers
159 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
1 answer
79 views

The question closely follows this one, except that I did what the git-prompt.sh does myself. However, I started noticing weird rendering issues, where long lines do not wrap on the next console line, ...
mEm's user avatar
  • 397
1 vote
0 answers
145 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
1 vote
0 answers
73 views

On macOS, I get a system popup when running UI tests in GitHub saying: “bash” is requesting to bypass the system private window picker and directly access your screen and audio. How can I disable ...
Anusree lakshmi's user avatar
5 votes
3 answers
148 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
0 votes
3 answers
81 views

When the text directly contained color code for example: a="\033[0;31mRED\033[0m" echo -e $a The terminal had no problem colorizing the text in red. But when I modified the color code ...
fronthem's user avatar
  • 4,141
3 votes
3 answers
182 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
0 votes
0 answers
77 views

I am running a legacy C++ build env with Tup, Lua5.4 on Debian13. When I run tup, under any user (also root) there are strange file permission issues. When I debug and do and "ls -l" the ...
Coen Damen's user avatar
  • 2,109
3 votes
6 answers
184 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
3 votes
1 answer
112 views

This gives a syntax error: read -p "entry: " entry sql="select concat('entry ', id) from mytbl where id = ?"; $mysql_conn "prepare stmnt from '${sql}'; set @id='${entry}'; ...
bungee1980's user avatar
-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
1 answer
100 views

My script to start the Rails server does not work when I use crontab. I have a script to monitor whether Puma is running or not, and subsequently start the Rails server in production. When I execute ...
Cleber Reizen's user avatar
0 votes
0 answers
51 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,650
3 votes
5 answers
197 views

I have this alias to format $PATH into one line per path: alias path='sed ''s/:/\\n/g'' <<< "$PATH"' I tried to specify the env var to list, like path $MANPATH but still with a ...
vulcan_'s user avatar
  • 167
0 votes
0 answers
64 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
1 vote
0 answers
137 views

I am working on creating an adaptive card dynamically. I have the skeleton on the card in JSON and I want to add entries to it (each entry will be a JSON object inside the "body" of the ...
moys's user avatar
  • 8,117
3 votes
3 answers
128 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
1 vote
8 answers
260 views

I'm trying to interact with an API which returns json and which uses pagination. Unfortunately, they don't give any indication when you're reached the end of the list, they just continue to respond ...
Jason Michael's user avatar
2 votes
3 answers
172 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
2 answers
99 views

In the below shell script, I'm trying to conditionally add elements to an array which is syntactically incorrect when checked in shellcheck. #!/bin/bash echo "Hello World"; HH=1 ARR=( &...
Harry's user avatar
  • 4,146
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
0 votes
1 answer
66 views

I have a problem with my bash file: each time I launch the terminal, this error occurs: bash: /home/hk/.bashrc: line 125: syntax error near unexpected token elif' bash: /home/hk/.bashrc: line 125: ...
Haytham Kennouz's user avatar
2 votes
0 answers
106 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
0 votes
0 answers
60 views

I have a file that I'm trying to put a spool command and the dos path as the first line: To get the dos path from bash I use: CWDDOS=$(pwd | sed 's/\//\\/g' | sed 's/\\c/C:/g') and it gives me this: ...
Erik Christiansen's user avatar
-2 votes
1 answer
122 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
0 votes
1 answer
78 views

This question is similar to LaunchAgent doesn't run shell script, but the solutions there didn't work for me as my situation is presumably much more complex. I have the following Bash script: #!/...
Kenny83's user avatar
  • 931
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

1
2 3 4 5
3138