Skip to main content
Stack Overflow for Teams is now Stack Internal: See how we’re powering the human intelligence layer of enterprise AI. Read more >

All Questions

Tagged with or
Filter by
Sorted by
Tagged with
0 votes
0 answers
14 views

Hex memory dump is Docsis config file. Is it possible to convert this hex dump info valid Docsis config file? Preferably, using Perl and DOCSIS::ConfigFile module. (or Python scripts, python-docsis). ...
Lexx Luxx's user avatar
  • 1,473
0 votes
0 answers
31 views

Hi I was just wondering if this script looks ok I run it after I login thanks. #!/bin/bash echo "hi, starting wifi, nft and desktop" sudo ls sudo systemctl start wpaStart.service sudo nft -...
asker152's user avatar
  • 119
2 votes
1 answer
196 views

Just in theory: is it possible to replace the domain string in the compiled binary file with an IP address by editing a binary file in place with sed? (IP address belongs to a different domain, but ...
fxgreen's user avatar
  • 143
0 votes
1 answer
35 views

Here is a sample directory tree as it would appear if it were sorted in character code order (i.e., directories are not listed first): ${PREFIX}/ .bashrc .include.sh.d/ common.sh ...
Melab's user avatar
  • 4,458
11 votes
1 answer
1k views

The test [[ -n $1 ]] yields True if the length of string is non-zero. But I've seen elsewhere and have tried using just [[ $1 ]] without the primary -n and it seems to have the same effect. Is there ...
CertainPensioner's user avatar
1 vote
1 answer
66 views

Suppose we have the file ./testing with contents #!/bin/bash # Flags # Source: https://stackoverflow.com/a/7948533/31298396 TEMP=$(getopt -o ''\ --long first,second \ -...
Grass's user avatar
  • 145
2 votes
1 answer
93 views

Using https://stackoverflow.com/a/7948533/31298396, we can implement flags for a script testing as follows: #!/bin/bash # Flags # Source: https://stackoverflow.com/a/7948533/31298396 TEMP=$(getopt ...
Grass's user avatar
  • 145
0 votes
4 answers
63 views

I would like to mount a partition of an external hard drive from a script using udisksctl mount --block-device /dev/sda1 and in the end of the script I would like to unmount it. However, it may ...
Alexey's user avatar
  • 2,380
5 votes
1 answer
341 views

Why these commands lead to opposite comparison results between -ne and !=? Seems != works but -ne does not? I thought they are the same while comparing strings. % set -o | grep pipe pipefail ...
WesternGun's user avatar
0 votes
0 answers
30 views

I am trying to run the following bash script: #!/usr/bin/env bash declare -A WM_CLASSES=( ["ALACRITTY"]="Alacritty" ["AUDACIOUS"]="Audacious" [&...
Ahmad Ismail's user avatar
  • 3,134
1 vote
2 answers
54 views

I have the following script flow: The parent script is launched from a non-interactive shell and sources a child script. child launches a background subshell with (...) & and contains no code ...
Betonmischer's user avatar
0 votes
1 answer
64 views

#!/bin/bash DefaultColor="\033[0m" GREEN="\033[32m" RED="\033[31m" PURPLE="\033[35m" YELLOW="\033[33m" CYAN="\033[36m" CmdOk="\033[...
Maxime's user avatar
  • 3
0 votes
0 answers
34 views

What do I want : On the file manager lf, we can bind some keyboard shortcuts to do either a lf command with :, or a shell command with $, !, or other symbols. According to the documentation, there is ...
ewen-goisot's user avatar
5 votes
1 answer
372 views

Common method for preventing concurrent runs for a given script is utilizing flock as: LOCK=/var/lock/my-lock exec 9>>"$LOCK" if ! flock --exclusive --nonblock 9; then echo "...
basher's user avatar
  • 71
0 votes
0 answers
50 views

I am trying to implement a shell(zsh) based Pomodoro clock and I encountered a problem: sending -STOP signal to background sleep process does not stop it. WesternGun@MyMacBook-Pro:~ [12:13:49] 0 % ...
WesternGun's user avatar
1 vote
1 answer
56 views

I am writing a bash script and I am aware that I can get information of the mounts attached to a container using docker inspect --format '{{.Mounts}}' <container-name> which gives a result such ...
neildeadman's user avatar
0 votes
2 answers
88 views

When timing a command with time, there is inevitably some overhead (from the CPU, operating system, shell and so on). Running the following code, from a tty text mode virtual console with all ...
Markus Klyver's user avatar
6 votes
2 answers
281 views

I use a simple backup bash script to copy some directories originally placed in a Debian (Testing) from a USB stick (formatted NTFS) to a MacBook. The names of directories are the same from origin to ...
user41063's user avatar
  • 213
-4 votes
1 answer
227 views

In the below shell script I'm executing the some command cmd remotely where in the command output is redirected to some file cmd_log. I'm getting the desired result as long as the command cmd itself ...
Harry's user avatar
  • 239
10 votes
4 answers
943 views

Without ;;&, /bin/sh gives Syntax error: ")" unexpected (expecting ";;"). ;;& triggers shellcheck's ^-- SC2127 (error): To use cases with ;;&, specify #!/usr/bin/env ...
Swudu Susuwu's user avatar
2 votes
1 answer
198 views

I have the following (excerpt from a) zsh shell script (the FOLDER environment variable is exported earlier in the code): # Create temporary directory export TMPDIR=$(mktemp -d) # Set TIMEFMT to ...
Markus Klyver's user avatar
0 votes
0 answers
75 views

This is a fairly bog-standard script, but my bash knowledge isn't huge, so here goes. The script is from here - the Apache Cloudberry project - an interesting open source version of a distributed ...
Vérace's user avatar
  • 601
2 votes
4 answers
147 views

#!/usr/bin/env bash exec {BASH_XTRACEFD}>./xtrace.log declare -p BASH_XTRACEFD set -x { : "how do you hide this in ./xtrace.log?"; } 2>/dev/null # fail # { :; } "${BASH_XTRACEFD:-...
anick's user avatar
  • 601
-2 votes
1 answer
128 views

In the below shell script I want to extract the fields of a string delimited by | character. But unfortunately I'm facing issue if there exists pipe command | in the string, because of which I'm not ...
Harry's user avatar
  • 239
1 vote
2 answers
339 views

In the below shell script, I am trying to get the process id of a remote process using ps command, but not getting the required output #!/bin/bash get_process_id() { local res local ...
Harry's user avatar
  • 239
0 votes
5 answers
865 views

I have a text file that mixes names and email addresses, in a comma-separated list. First Person <[email protected]>, Second Person <[email protected]>, Third <[email protected]> ...
hugomg's user avatar
  • 6,105
-4 votes
2 answers
277 views

In the below shell script I have list of process IDs which need to be killed. When killing a process I am getting kill: 1234567: no such process error even after checking if the process id existence ...
Harry's user avatar
  • 239
-3 votes
3 answers
139 views

In the below shell script I am passing an integer and a string array to a print function which should print each parameter separately, but I'm not able to. I don't want make a reference of passed ...
Harry's user avatar
  • 239
-2 votes
3 answers
159 views

I need a part for a script in bash where hashes are generated automaticaly and continuously and when I press a key the generation stops and the last hash at which I stopped is displayed. I've cobbled ...
Orhan's user avatar
  • 65
1 vote
2 answers
128 views

In bash I can use local -n ref_name=$1 to pass an argument to a function by reference, but the same syntax in ksh throws an error saying typeset: -n: unknown option I tried nameref ref_name=$1 ...
Harry's user avatar
  • 239
1 vote
2 answers
240 views

In Bash I can use $(type -t function_name) = "function" to check if the function by name function_name exists or not in a sourced file which is sourced using source file_name command. I'm ...
Harry's user avatar
  • 239
1 vote
1 answer
80 views

I have the below shell script which works fine in Bash to list all the directories residing inside a given directory path and add them to an array. But the same script code doesn't work in KornShell. ...
Harry's user avatar
  • 239
13 votes
1 answer
2k views

I am currently relearning a few basics about shell scripts and encountered the following problem. I have the following script error.sh #!/usr/bin/env bash n=$(( RANDOM % 100 )) if [[ n -eq 42 ]]; ...
ttnick's user avatar
  • 233
0 votes
0 answers
83 views

I’m using BTRFS snapshots for my backups with Restic, and with the help of GenAI I created a script to automate the process. I take snapshots of a subvolume called home, which contains three ...
matteo-g's user avatar
  • 103
1 vote
1 answer
172 views

If executed manually with sudo, the script does its job. #!/bin/bash echo "Script executed at $(date)" >> /var/log/realtimesync.log echo /opt/FreeFileSync/RealTimeSync /mnt/harddrive/...
birdman's user avatar
  • 407
4 votes
4 answers
838 views

Hello i try to check if a path exists with a if statetment in a bash script from a string. I try the follow but nothing seems to handle this. The path is /home/orhan/Blog/Mai1 path='/home/orhan/blog/...
Orhan's user avatar
  • 65
2 votes
2 answers
386 views

I want to know if there is another alternative in Bash to execute multiple blocks when the pattern matches. I don’t want to use another command, if statements, or two or more separate case blocks or ...
ReflectYourCharacter's user avatar
4 votes
4 answers
546 views

Given this code: #!/bin/bash set -euo pipefail function someFn() { local input_string="$1" echo "$input_string start" sleep 3 echo "$input_string end" } function ...
k0pernikus's user avatar
  • 16.7k
5 votes
4 answers
516 views

I have a large folder of data files, which I want to copy into subfolders to make a specified number of batches. Right now I count how many files there are and use that to make ranges, like so: cd /...
rubberduck's user avatar
10 votes
7 answers
1k views

I am writing a script that locates a special type of file on my system and I want to check if those files are also present on a remote machine. So to test a single file I use: ssh -T user@host [[ -f /...
Nunkuat's user avatar
  • 203
-2 votes
2 answers
102 views

so trying to capture history with date and readable timestamps AND the command should appear on same line. following is failing: Bash ver is: GNU bash, version 4.4.20(1)-release (x86_64-redhat-linux-...
Rajeev's user avatar
  • 268
2 votes
1 answer
170 views

Continuing Semicolon in conditional structures (which handles single brackets), what's the point of having a semicolon after the closing DOUBLE bracket ]]? In my tests, running #!/bin/zsh -- if [[ &...
AlMa0r's user avatar
  • 1
1 vote
1 answer
100 views

In Linux there are some Folders. I want to process each of this Folders with the program myprogramm. I get a list with ls -1 or much better, sure only Folders with: find . -maxdepth 1 -type d -printf '...
Banana's user avatar
  • 241
1 vote
0 answers
68 views

I send emails from the terminal with mutt -s "This is Subject" -a a.txt -- [email protected] < test.txt. The a.txt attachments can be large, how can I avoid filling up the mail server? ...
Nikulok's user avatar
  • 33
2 votes
1 answer
119 views

I need to send a letter from Linux terminal to the recipient's mailing address. I want the fact of sending the letter, its title and its text to be saved in the sent section of my mailbox (the mailbox ...
Nikulok's user avatar
  • 33
5 votes
2 answers
846 views

In the file /usr/bin/gcore (which is a bash script on my system), there are the following lines: # When the -a option is present, this may hold additional commands # to ensure gdb dumps all mappings (...
The Quark's user avatar
  • 454
0 votes
2 answers
312 views

I have tried to install Howdy, but it would always return with this message: >>> Upgrading pip to the latest version error: externally-managed-environment × This environment is externally ...
Khrizantema2x8's user avatar
0 votes
5 answers
213 views

In Linux in a directory there are files, ls -1 shows me this output : file1.1-rvr file1.2-rvr file1.3 file1.4-rvr file1.5 file1.6-rvr file2.1 file2.2 file3.1 file3.10 file3.2-rvr file3.3-rvr file3.4 ...
Banana's user avatar
  • 241
4 votes
0 answers
122 views

The window of my text editor Xed froze with Unsaved documents just as I was doing 'File'->'Save as...' to save them... [How ironic.] Since the process still exists, I am trying to recover the text ...
The Quark's user avatar
  • 454
6 votes
1 answer
263 views

In bash I'm using this common pattern where null-terminated list of process output is processed in a loop, e.g. declare -a commits while IFS= read -r -d $'\0' c; do commits+=("${c%% *}") ...
laur's user avatar
  • 804

1
2 3 4 5
336