Skip to main content

All Questions

Tagged with or
Filter by
Sorted by
Tagged with
-5 votes
0 answers
51 views

This question is regarding a basic bash script copying files. I have the source folder structure as below. folder1/folder2/folder3/folder4/folder5/text.txt The destination folder structure is ...
Newbie 's user avatar
-3 votes
0 answers
80 views

I have a script that does three things in a loop: Do one thing when started Wait one day (sleep 1d) and then do this thing again Repeat while the processname is active A quick example based on a ...
Verity Freedom's user avatar
2 votes
1 answer
98 views

I am writing a simple bash script for computing time and date by adding seconds onto a random date that I give. It worked fine so far but going from 2016-03-13 00:00:00 to 2016-03-13 03:00:00 skips ...
Redshoe's user avatar
  • 379
0 votes
0 answers
63 views

Environment: Ubuntu 24 I'm trying to create a bash script to turn on/off the backlight after a period of time keyboard if no key is pressed. It's working when I run it by hand, but when I try to run ...
sz3bbyLA's user avatar
0 votes
0 answers
98 views

Given: #!/bin/bash set -x cat <<EOF | while IFS= read -r LINE; do "${LINE}"; done /usr/bin/bash pstree -u "${USER}" EOF It outputs: $ ./cat_while_bash.sh + cat + IFS= + read ...
Etienne M's user avatar
  • 733
3 votes
2 answers
74 views

Running Ubuntu 24.04lts. NOTE: I am trying to read the notification sent by he Discord app to my personal desktop notifications. When I notification from a specific sender, with a specific message, I ...
Joshua Besneatte's user avatar
0 votes
1 answer
55 views

I have a python script that runs as a service on raspi, the script executes a bash script which then connects to a windows pc via SSH using a key. I have successfully use the same code to connect to ...
zorodluffy's user avatar
2 votes
1 answer
53 views

I am trying to implement a CIS hardening rule on Ubuntu that requires every GRUB linux entry to include: apparmor=1 security=apparmor Audit script #!/bin/bash if grep "^\s*linux" /boot/grub/...
ÇAĞRI KARAKUŞ's user avatar
Best practices
3 votes
2 replies
92 views

I want do download certain search results from the internet archive. I would like that the names of the resulted files and directories to be the title of the work -- idealy YYYY_<author>_<...
alex's user avatar
  • 1,145
-1 votes
1 answer
105 views

I am trying to run a bash command through Java.Runtime.exec(), specifically coredumpctl. I am only able to run the command on a bash terminal when I login as a root user, and this doesn't seem to be ...
user23282541's user avatar
2 votes
1 answer
168 views

for in in Bash is setting variable. I need only the variable itself from this command. for VAR in FILE*; do something (hate it) done I plan to use this variable later, not in the block itself. Just ...
Verity Freedom's user avatar
Best practices
1 vote
10 replies
170 views

I want to write a small tool or Bash snippet that can be used like: tool key value file and it should replace all occurrences of key in file with value. I tried: sed -i "s/${key}/${value}/g"...
Qiu Yangfan's user avatar
Advice
0 votes
1 replies
53 views

This script adds a line to add custom.js to vivaldi browser directory: #!/bin/bash vivaldi=/opt/vivaldi/resources/vivaldi moddir=$HOME/vivaldi-modding/ sudo cp $moddir/custom.js $vivaldi sudo sed -i -...
Rainer Brumshagen's user avatar
6 votes
4 answers
145 views

I was working on a one-liner to subtract a constant value (e.g. 100 in this case) from a specific column using awk. So far I can manage to get to where I can print the last iteration only – which ...
Matteo's user avatar
  • 527
0 votes
1 answer
88 views

I created a script that is run by cron to open a tab in firefox. It will open a tab in firefox, but the tab is a new window. If I have firefox open, I need it to open in the same window that is ...
user3273814's user avatar
5 votes
2 answers
153 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,986
1 vote
0 answers
68 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
71 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
60 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
3 replies
45 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
63 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,987
0 votes
0 answers
67 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
121 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
42 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
34 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
83 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
125 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
51 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
422 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
132 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
139 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
39 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
1 vote
1 answer
48 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
  • 65
2 votes
1 answer
93 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
76 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
92 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
  • 819
2 votes
2 answers
126 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
165 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
81 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
153 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
76 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
154 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
86 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
188 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,985
0 votes
0 answers
80 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
185 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
117 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
-2 votes
1 answer
130 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,275
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
52 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

1
2 3 4 5
3138