Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
97 views

How can I exit the bitbucket pipeline step (as successful) early if a specific output is matched, and output a custom message. Otherwise just continue the normal output. pipelines: custom: - ...
danladis's user avatar
3 votes
1 answer
153 views

I need a bash script to check if 'sudo' WOULD be able to works without prompting for a password. How do you best test for sudo as being ready to go and not needing a password because its session has ...
John Greene's user avatar
  • 2,718
3 votes
1 answer
97 views

Why does this work to create an array out of the newline separated elements: declare -a themes IFS=$'\n' themes=($(plutil -extract 'Window Settings' xml1 -o - - <<< "$terminal_settings&...
Camden Narzt's user avatar
  • 2,075
4 votes
0 answers
197 views

Every time when I was doing the GPG signed git commit (e.g. git commit -S -s -m "test"), the password prompt is in the CLI console. The password prompt before was a proper GUI pop up window ...
ONLYA's user avatar
  • 63
-4 votes
1 answer
104 views

How to make sure ImageMagic never overwrites files? To avoid this type of situation: name1=$(identify -format '%[EXIF:DateTime]' input1.jpg) magick -options... input1.jpg name1.jpg # concurrently ...
VasiliNovikov's user avatar
2 votes
3 answers
235 views

I recently learned that there is a special case of command substitution: The command substitution $(cat file) can be replaced by the equivalent but faster $(< file). I never use the cat variation,...
Albert Camu's user avatar
-1 votes
2 answers
172 views

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 ...
rappluk's user avatar
  • 25
0 votes
2 answers
152 views

I have a script which sets useful git settings and aliases, and I want to end by printing the difference between git config --global --list before and after. I'd like to show the diff in the same ...
H.v.M.'s user avatar
  • 1,746
0 votes
0 answers
114 views

I want to create Widget through bash script and Graylog 6.3 API But I didn't find the proper new API for that, like the old versions. i have created the input, stream and then search and dashboard(...
Idris Saddi's user avatar
0 votes
1 answer
82 views

I have this script to get images from a webcam & process them via RKNN NPU #!/bin/bash # Define the temporary directory for images TEMP_DIR="/media/32GB/pics" # Define the resize/...
nightcrawler's user avatar
2 votes
1 answer
165 views

When writing snippets, I got into the habit of using expansions, such as: #!/bin/bash echo "You have provided ${1:?} as command line argument." declare -r x=${1:?} # from now on, x is ...
Albert Camu's user avatar
0 votes
0 answers
110 views

I'm running a Kubernetes Job from a Jenkins pipeline and want to stream its logs until completion. I currently use this pattern in a Bash script: job_status_cmd_complete="kubectl get job ${...
Ciprian Istrate's user avatar
1 vote
1 answer
118 views

I wrote simple pam module to ran my own program, when session was created. When I login in GUI (by SDDM), everything works. Problem occurs, when login on tty (CTRL+ALT+Fn). In this case, bash wrote ...
nintyfan's user avatar
  • 462
0 votes
1 answer
99 views

I have the following script and makefile: Makefile WORKING_DIR := /home/user1/working_dir outdir := /home/user1/working_dir/outdir script := ./myscript.sh my_target: file1.ini file2.ini file3.ini ...
Ulises V.'s user avatar
1 vote
1 answer
200 views

I am writing a script that must be sourced and that I use daily in the terminal (zsh), and the solution to one of a problem in the script is to unlock a flock lock, I would do it in the trap for ...
Urpagin's user avatar
  • 23
0 votes
2 answers
122 views

I can get the return value from a function foo without problem such as: $ cat test.sh #!/usr/bin/bash foo() { echo "hello" return 20 } bar() { x=$(foo) rc=$? echo $rc } bar ...
crackpot's user avatar
  • 425
4 votes
1 answer
100 views

Subshell traps show parent traps with trap -p, but do not execute them. Is it possible to get the "do not execute them" state? when trap -p returns the parent state? Do I have to track trap ...
KamilCuk's user avatar
  • 146k
4 votes
1 answer
102 views

How do I return variables from curly braces? For example, how do I get the return value of the command curl outside the curly brackets in the following snippet? #!/usr/bin/bash { # scope for tee ...
crackpot's user avatar
  • 425
-2 votes
2 answers
162 views

I currently making a project to write my own shell, a very simple one, but i got stuck on how I can differentiate a SIGINT signal received inside a heredoc and while interactive mode. In bash, ...
Rache Bartmoss's user avatar
-1 votes
1 answer
167 views

I have the following source file named test.txt: text before ---BEGIN MARKER--- content 1 ---END MARKER--- text between ---BEGIN MARKER--- content 2 ---END MARKER--- text between ---BEGIN MARKER--...
Wiimm's user avatar
  • 3,753
1 vote
2 answers
96 views

I'm trying to do some date/time calculations in bash that don't work as expected at the console and when I add them to environment variables, I get very odd results. As an example: $ date Thu Jul 24 ...
thepip3r's user avatar
  • 2,975
1 vote
1 answer
108 views

as described in "Add new element to existing JSON array with jq" I am using this jq form to add elements to a JSON array. This works fine in the command line. Short minimal version here: jq '...
fernan's user avatar
  • 46
1 vote
0 answers
128 views

I have a strange problem with BASH 4.4 and RPM 4.13.3: I used (extracts only) %prep %define template_list template{,_{AFC,AIC,ALC,CCT,CRC,GLC,ILC,LPE,PPI,PPO,PWC,\ SPE}} #... %build for file in %{...
U. Windl's user avatar
  • 4,748
0 votes
0 answers
37 views

I'm trying to get a list of files that don't match a pattern -- in this example, scripts that do not end in .csh. This works properly on the command line: ls ~/bin/!(*.csh) However, running that ...
Codes with Hammer's user avatar
0 votes
1 answer
153 views

In Windows cmd you can run wsl commands just by typing: > wsl pwd /mnt/c/Users/user/ But when I try to run functions that are stored in ~/.bashrc file, nothing is happening: > wsl test > ...
IGRACH's user avatar
  • 3,726
2 votes
4 answers
136 views

I want to be able to use sed (POSIX) to replace some text in the output from a command with a different message that includes escape sequences to allow me to set the colour. To illustrate the problem. ...
Mike T.'s user avatar
  • 417
2 votes
2 answers
161 views

git diff normally will not generate an output, if the two commits it compares are identical, to make it generate explicitly "the two commits are the same", I found the bash script below. ...
athos's user avatar
  • 6,517
2 votes
7 answers
163 views

I have a test.txt file looking like this : a,1,A b,2,B c,3,C d,4,D e,5,E f,6,F I want to modify the second field with some condition : if value is 1 I modify it to 1_PLUS if value is 4 I modify it to ...
Fabrice's user avatar
  • 455
-4 votes
1 answer
102 views

just having a play around with Bash to automate some things (I'm by no means an expert!) but am having trouble with some syntax. I'm using the AWS CLI to try and delete some log groups. I have the ...
ADringer's user avatar
  • 2,866
0 votes
0 answers
63 views

I see this error in gitlab runner job when im trying to use bash executor: Running with gitlab-runner 17.11.0 (0f67ff19) on xx-shell txxxx, system ID: 123 Resolving secrets Preparing the “shell” ...
shwetha nayak's user avatar
0 votes
0 answers
55 views

I am confused by a difference in the behavior of bash and zsh when running the same simple piped command in both of them. When I run sleep 4 | wc < text.txt in bash, I get 0 0 0 as output instantly ...
Anili's user avatar
  • 138
0 votes
2 answers
135 views

I'm trying to print a special character from a Shell script. printf '\U002F' works in interactive shell, but not from Bash shell script. Shell script keeps printing \u002F. I tried to escape \, but it ...
Faxopita's user avatar
  • 105
-1 votes
1 answer
174 views

I have 8 blocks of code: this, with a different path and site name. My goal is when the first word of the return is something other than "Success:" print the entire line, preceded by the ...
spinhead's user avatar
0 votes
1 answer
96 views

Applicable for use in a bash script match substring as whole word only in parent string? For example parent string: A='enp1s0 enp2s0 enp3s0 enp4s0 lo tailscale0' And substring: B='enp1s' I have ...
Dachshund Digital's user avatar
0 votes
2 answers
154 views

I want to know if there is a (hopefully simple) way to export all bash functions and variables for the scope of just one command. Much like how you can env VAR=VALUE cmd in bash but export all ...
profPlum's user avatar
  • 521
1 vote
1 answer
78 views

if I run while read -r -d: path; do ls $path; done <<< "${PATH}" I get the right output. But if I run while IFS=: read -r path; do ls $path; done <<< "${...
Helgi Sidorov's user avatar
1 vote
2 answers
110 views

I am trying to extract the file date from the output of a gsutil ls -l command and compare it to other dates. However, the comparison appears to be not working. lstr=$(gsutil ls -l gs://input-bucket/...
marie20's user avatar
  • 895
4 votes
4 answers
241 views

I think this is simple, but it's not working for me. This is what I have. float=$(awk -v res="$result" 'BEGIN {printf "%.2f", res / 1000}') I want to use a variable to set the ...
WesZ's user avatar
  • 303
0 votes
1 answer
97 views

I want to simulate a playhead moving over a waveform, like when playing a track in an audio editor. As far as I understand, I can generate this effect if I have both the audio file and an image of the ...
terrorrussia-keeps-killing's user avatar
0 votes
1 answer
95 views

not sure how to categorize the following issue, I thought about relating it to BASH or Python first, but actually it's rather language-independent imo... Anyway, I was searching but couldn't find any ...
SevenChalices's user avatar
-6 votes
2 answers
169 views

I want the read function to print anything but the new line when using in Bash script. I tried the following code, but it does not help. It still prints the new line. Minimal reproducing code: #!/bin/...
Sergey Belenkov's user avatar
5 votes
1 answer
139 views

Context : I am making my own cloud save manager for my non steam games, I am in the process of implementing a wrapper that launches games but also loads file from the cloud before opening and when you ...
Tima_ben's user avatar
1 vote
1 answer
112 views

In Chinese, the single quotation marks are ‘ and ’, and the double quotation marks are “ and ”. In daily work, I need to switch between English and Chinese input methods in order to write different ...
ElpieKay's user avatar
  • 31.7k
-3 votes
3 answers
120 views

prepend() { [ -d "$2" ] && eval $1=\"$2':'\$$1\" && export $1; } So I came across this function and let's say I run it as prepend PATH /home/xyz/bin Now, I am not ...
Rohit Rai's user avatar
0 votes
1 answer
61 views

The issue I'm having is this, in the current directory I might have multiple folders like: "Aburner", "Btoads", "and "gigawing", each with multiple files inside of ...
Wolf_'s user avatar
  • 33
2 votes
2 answers
83 views

Can I simplify the following command in a single --exclude field? rsync --exclude .[tT]rash*/* --exclude [tT]rash*/* <omissis> The following seems to work but does include 'wtrash' (and other ...
Antonio Rizzo's user avatar
1 vote
2 answers
145 views

I am trying to organize a large group of files for use with another program that can run them archived but only if they are named for example "My Document.7z" and not "My Document.txt....
Wolf_'s user avatar
  • 33
0 votes
0 answers
73 views

I have access to MariaDB, which I can reach only through an SSTP VPN. I wanted to create an additional container in docker-compose and share the network with the application container. I wrote the ...
OrderNick's user avatar
0 votes
1 answer
220 views

I have two VM's running keepalived. I have created a vrrp script to check if a container is running and if not decrease the priority of the vrrp node so that it causes a failover. However on the ...
Leon_P's user avatar
  • 1
0 votes
2 answers
138 views

I have the following function play-music() { local selected=$(find "${PWD}" -mindepth 1 -maxdepth 1 -type f -iname "*.mp3" | LC_COLLATE=C sort | fzf) local processed="...
Rittwik Chatterjee's user avatar