93,024 questions
0
votes
0
answers
91
views
keyboard backlight script not working well [closed]
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 ...
2
votes
1
answer
74
views
Is there a functional difference between piping a variable with printf vs using parameter expansion in a heredoc?
Is there a functional difference when piping a shell variable with printf or using a heredoc and expanding the variable inside the heredoc?
Piping:
txt=…
printf '%s\n' "$txt" | xxd
Heredoc:
...
1
vote
1
answer
47
views
GIT command is not returning any value in makefile
I have a simple makefile that should print the Git log, which looks as below.
SHELL=/bin/bash
get_log:
echo $(git log)
3
votes
3
answers
145
views
Reading desktop notifications from the command line. Debian/Ubuntu
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 ...
Advice
0
votes
1
replies
41
views
Analyze a directory in a performant (cross-platform) way for what file types (file extensions) it (recursively) contains?
Aim
My aim is to analyze a (big) (sub)directory and just find out what file extensions all files have there (recursively).
Additionally, these conditions apply:
I am on Windows, but I could use WSL ...
Best practices
3
votes
2
replies
97
views
How to efficiently bulk download from the internet archive
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>_<...
2
votes
1
answer
175
views
How to do nothing with "for in" in Bash? [closed]
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 ...
1
vote
1
answer
75
views
Disable touchpad script fails while copied output works
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 ...
Tooling
0
votes
7
replies
133
views
One liner to get distinct values of all columns of a tsv
I am looking for a one liner that could be run in a linux terminal that does the below.
Takes as input a tab separated file (tsv) with many columns (~100) and creates a two column tsv output with ...
2
votes
4
answers
141
views
Is it the tty, the shell, or both that is responsible for echo-ing user input?
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 ...
1
vote
1
answer
82
views
How do I feed standard input to an Expect script to spawns a shell and collect standard output?
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 -- [...
3
votes
1
answer
82
views
How to grep multiple words from a remote file in a SSH command to a target server
I wanted to execute the below command. I have a file with server names.
for i in \`cat /tmp/srv_list\`; do ssh $i "uname -a; uptime; grep -E "warn|error|failed|issues" /var/log/...
5
votes
3
answers
155
views
How to get the actual $0 as typed by the user in Bash?
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 "...
3
votes
3
answers
188
views
git config alias function : Bad substitution
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:-.}; \
...
1
vote
1
answer
60
views
Copy stderr of previous command without rerunning it
(I am using the kitty terminal emulator, though I would appreciate answers for other terminal emulators as well.)
I run a command, and get some error message, like this:
~ » somecommand
❌️ Some Error ...
3
votes
5
answers
199
views
Using a function to format any list of PATHs
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 ...
1
vote
0
answers
58
views
VSCode debugpy launcher command not executing automatically in terminal after shell initialization commands
Problem
When launching a Python debug session in VSCode using debugpy, I see three commands spawned in the integrated terminal:
devbox shell - executes automatically ✓
source /path/to/project/.venv/...
0
votes
2
answers
94
views
How can I break a loop condition into multiple lines in a shell script?
Right now, this is working:
while read attribute_one attribute_two; do
read -r -d '' json_payload << EOF
{
"attribute_one": "${attribute_one}",
...
0
votes
0
answers
150
views
.NET MAUI Android: TabBar overlaps with Navigation Bar
I'm building a .NET MAUI app and facing an issue on Android — the TabBar (Shell tabs) overlaps with the system navigation bar at the bottom of the screen.
Here’s what happens:
The tabs are partially ...
2
votes
3
answers
178
views
How to pipe a data file with multiples read values to a bash script with a delay between them? It is possible to display the info read from file
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 ...
1
vote
2
answers
100
views
How to conditionally add elements to an array in shell script
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=(
&...
0
votes
2
answers
120
views
Running chain of commands through Python script [closed]
I am running the following command though a Python script:
tcsh -c 'cmd1 && cmd2 && cmd3 && cmd4'
Only the first command is getting executed or the first two commands are ...
0
votes
0
answers
82
views
AHK2 overlay only stays visible above taskbar when a file write triggers a refresh — any better alternatives?
I'm trying to keep a transparent always-on-top overlay (made in AHK v2) above the taskbar in Windows 10/11.
The Problem:
Everything works except when the Aero Peek / Show Desktop event fires (e.g. via ...
1
vote
2
answers
83
views
Ignore patterns not found in ex substitute command
POSIX.1-2017 specifies two line-oriented file editing utilities: ed(1) and ex(1). ex is more efficient for noninteractive batch-editing because POSIX requires it to accept one or more file operands, ...
0
votes
0
answers
33
views
macOS Automator Quick Action (Zsh script) using cpdf completes with success message but creates no output files
I am trying to create a macOS Quick Action that allows a user to select multiple chapters from a PDF's bookmarks and extract each one into a separate file. The script uses the cpdf command-line tool ...
1
vote
1
answer
86
views
Printf command stops working when DEBUG trap is active?
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"
...
1
vote
2
answers
102
views
How do I place the output of a command in the search pattern section of sed?
I'm trying to place the output of awk 'NR==4 {split($0, a, "$"); print a[3]}' filename in sed -i 's/1/2/' hyprpaper.conf such that 1 is replaced by the output of the command awk 'NR==4 {...
2
votes
1
answer
78
views
Bash process id and parent process [duplicate]
I am using the following Bash script. What I don't understand is why the parent PID and the current PID are not matching. For example:
#!/bin/bash
my_background_function() {
echo "Starting ...
0
votes
0
answers
99
views
ubuntu curl: (3) URL using bad/illegal format or missing URL
Given the following script:
curl --interface wlan0 --connect-timeout 60 --max-time 1800 -X PUT -T /tmp/compress_log/20250922_utc.tar.gz "https://ota.eu.globe-groups.com/devicelogs/881e3272-4ab4-...
0
votes
1
answer
99
views
Trying to XOR for a string in hex using radare2 in a DOS executable on Linux. Am I doing this right?
I've tried to build a shell script that iterates through all possible XOR obfuscations of a string within a DOS binary executable, parsed using radare2 in hexadecimal, and find it. Am I doing this ...
-2
votes
1
answer
72
views
Why can't I find the installation path of nvm or use it in another shell script? [closed]
Recently I found something really unnerving on my Linux environment (Ubuntu 24.04):
peng@pop-os:~$ nvm
Node Version Manager (v0.40.3)
Note: <version> refers to any version-like string nvm ...
-1
votes
2
answers
227
views
Automatically Converting Windows Shortcuts to Linux Links using Bash
Mid-switch to Linux I realized I've a large personal and work archive that has over 1100 Windows Shortcuts(.lnk) of both files and folders and it is unusable without them and have been trying to ...
1
vote
2
answers
71
views
Custom Python module development environment installation
I would like to make a simple python script, that will create a virtual environment, then activate that environment, install pip modules from a req.txt file in the same shell that I just activated ...
-2
votes
1
answer
182
views
How can I tell if lighttpd is running on Debian 13? [closed]
My task was to port debian12 to debian13. In debian13 I noticed that the website was behaving differently with Perl v5.40.1. I found out that the following line returns different values on different ...
-3
votes
1
answer
157
views
Can `jq` be forced` to take slightly malformed JSON body? [closed]
I like using :!pbpaste | jq to see my JSON objects when reading logs in vim.
But it often throws the following error with the slightest inconvenience in the JSON body.
jq: parse error: Invalid numeric ...
0
votes
0
answers
51
views
My .justfile is passing an argument to my Dockerfile and giving me an odd EOF error
I have a Docker build process that requires access to my AWS Code Artifact repository for Python packages that I store there. This is my Dockerfile. Notice that it accepts PYTHON_REPO_URL and uses it ...
1
vote
1
answer
136
views
find: paths must precede expression: `\)'
I'm trying to implement simple wrapper for find to find files, links or both. Here is path of my code:
typeArr=()
if [[ "$type" == "f" || "$type" == "l" ]]; ...
-3
votes
1
answer
112
views
What's keeping my 32-bit Windows icon overlay extension from loading? [closed]
I've developed a couple of Windows Explorer shell extensions in C++ implementing IShellIconOverlayIdentifier, and they've worked fine. But this time, I need to do it in a 32-bit build, for a 32-bit ...
0
votes
0
answers
28
views
I want to build mdadm binary ad include it in my bundling
I want to get latest mdadm(4.4) built as binary and to be included in my bundling. These are the steps followed.
sudo dnf groupinstall -y "Development Tools"
sudo dnf install -y gcc make ...
2
votes
0
answers
39
views
Bash equivalent of csh's $?var [duplicate]
csh and tcsh use the syntax $?var to test whether a variable is set or unset. $?var or ${?var} expands to 1 if $var is set (even if it's set to the empty string), or to 0 if it isn't. This 0 or 1 ...
1
vote
0
answers
23
views
Blades reporting as Target not found in inventory service, while executing an RTO for VR FW deployment
Raising this ICM after seeing this message in RTO - Target not found in inventory service. Either Target: 'a2f578be-f7f9-992b-45dc-20bff334b092' is invalid or doesn't belong to 'Public' cloud.Below ...
3
votes
1
answer
172
views
Why is awk not identifying the row of a file which is being extracted using an id from a second file? [closed]
I have a large file with several columns and millions of rows. The first column is a unique id for each record which is a long integer. From this large file I need to create a subset with few thousand ...
0
votes
0
answers
63
views
Is there any way to automatically detect adb port in bluestacks?
I am currently working on a project and need to connect in bluestacks using adb and code in c#:
I have a problem when every time I use the command adb:
C:\Windows\system32>"C:\Program Files\...
2
votes
0
answers
99
views
How to debug a Windows 11 context menu display?
I'm updating an old Windows app to use the Windows 11 IExplorerCommand context menu interface, using a sparse package to give the app an identity. It was (mostly) working, but at some point in the ...
-2
votes
1
answer
115
views
Shell script get aws Instance details
I am using shell script to get instance id and instance state on the basis of instance name. And for that I am using below query in shell script:
INSTANCE_NAME = "ABCDED00WEB"
...
2
votes
1
answer
115
views
Still reachable valgrind report when execve fails
I am building a shell as part of a school assignment, a limited version of bash. The whole program seems to function alright without any kind on leaks, but when I send invalid/nonexistent commands ...
-1
votes
2
answers
184
views
Compare two big folders quickly in Linux, without caring about exact file diffs [closed]
So, I have got two directories personal_files and personal_files_oldcopy
Through some file processing, I am not sure if both directories contain the same structure, or additional / missing files are ...
0
votes
1
answer
69
views
Use variables as shell inputs in Makefile
How can I use the output of a shell script as variable in another shell script. Suppose the following Makefile
build:
DOCKER_IMAGE_ID=$(shell docker build -q -t myimage .); \
OUT=$(shell ...
-2
votes
1
answer
136
views
How to show timestamp only on Zsh prompt immediately after running a command, not before?
I want to customize my zsh prompt so that when I open the terminal, it shows a normal prompt without a timestamp, like:
ABIR~ ❯
When I type a command (for example, ls), the prompt still shows no ...
-1
votes
1
answer
63
views
Sorting text lines by a field formatted as time stamp with shell commands [closed]
I want to sort lines with time format strings using shell command.
Shell shall be a common linux shell.
Example input:
results/fn_a:# Generated on: Mon Jul 21 17:20:48 2025
results/fn_b:# ...