Skip to main content

All Questions

Tagged with or
Filter by
Sorted by
Tagged with
0 votes
2 answers
210 views

I have to run four separate if statements (and their consequences) on one command output continuously as it updates (doing four different things based on four different strings which might be in the ...
Gridzbi Spudvetch's user avatar
0 votes
0 answers
69 views

I want to only print the debug output on failure, this is my attempt: #!/bin/bash set -euo pipefail dt-api() { # shellcheck disable=SC2086 curl \ --fail-with-body \ --silent \ ...
Jakub Bochenski's user avatar
4 votes
4 answers
479 views

I want to extend multiple globbing patterns with the same extension in a concise way. Here's what I tried (with only two initial patterns for demonstration purposes): myglob="*.log *.json" ...
glades's user avatar
  • 126
0 votes
0 answers
21 views

For the shell fans (bash) : I want a variable to get a value resulting from an operation output which contains an globbing character (such as *), and the shell expansion always happens, even if I ...
misterpc's user avatar
0 votes
0 answers
48 views

I am trying to script a job which interacts with mysql. I am using a variable to store a long command line. But when run via a script this does not behave as expected. I can reproduce the issue as ...
symcbean's user avatar
  • 6,360
0 votes
1 answer
119 views

The urgent issue to read keyboard input in the pipeline is solved by the answer in https://stackoverflow.com/questions/15230289/read-keyboard-input-within-a-pipelined-read-loop: mycommand-outputpiped |...
Martian2020's user avatar
  • 1,501
-7 votes
2 answers
185 views

In Linux, using Bash, I have two scripts: script.sh is the main script, and script_config.sh is the configuration for script.sh. In script.sh, I do source script_config.sh to load all the config ...
user447274's user avatar
-3 votes
2 answers
295 views

I've recently been playing with the legacy Bourne Shell from the GitHub repo heirloom-sh. It's installed at /usr/local/bin/sh with no symlinks. One script is invoking it via #!/bin/env sh. I'm running ...
Jesse's user avatar
  • 355
4 votes
1 answer
713 views

In bash (Ubuntu 24.10, but I guess this would apply to other versions/distributions) when you type in a console a command you can use TAB to autocomplete the filenames of the current directory. ...
Mark's user avatar
  • 805
0 votes
1 answer
107 views

I'm new to working with OS and unix, I'm trying to create separate users for an application, nginx, etc... and in order to run the process on their behalf. I'm currently debugging the following ways ...
aiswe's user avatar
  • 3
-1 votes
1 answer
96 views

I have the following situation: I'm creating a directory with an & at the end, something like this: inventory& But, when I run the command mkdir "inventory&" the linux system ...
Haroldo Payares Salgado's user avatar
7 votes
2 answers
892 views

Consider the following script: #!/bin/bash foo=Hello bar=Word cat <<EOF No quotes single word delimiter expands $foo $bar EOF cat <<'EOF' Single-quoted single word delimiter does not ...
merlin2011's user avatar
  • 4,209
1 vote
2 answers
89 views

The GNU History Expansion reference lacks examples, so I can't tell if this is possible. Here's what I want to do. I ran cat long/path/to/file1.txt | less, then I ran vim file2.txt. Using history ...
Daniel Kaplan's user avatar
1 vote
2 answers
119 views

stty -a shows cchars: stop = ^S, reprint = ^R. Ctrl-r is shadowed by readline's reverse-search-history, so when I press it I get the readline function Ctrl-s is not shadowed by readline's forward-...
user615536's user avatar
2 votes
2 answers
445 views

I am trying to write a bash script to download all the videos from a given public YouTube playlist. Here's what I have so far: #!/bin/bash # Default values decode_video=true output_format="avi&...
errorous's user avatar
  • 123
0 votes
2 answers
135 views

I am interested in analysing 50 different datasets with a script and saving the output of each of the 50 analyses in 50 different corresponding directories. To avoid doing this manually, how could ...
Carlos Fernandes's user avatar
0 votes
1 answer
68 views

I instructed my terminal emulator to send "\u{85}" (C1 control character "NEXT LINE" (NEL)) down the pipe to be caught by bash: bind -x '"\u0085":"echo Hello"' ...
glades's user avatar
  • 126
-3 votes
2 answers
184 views

Input data: id,location_id,name,title,[email protected],department 1,1,Susan houston,Director of Services,[email protected], 2,1,Christina Gonzalez,Director,[email protected], 3,2,Brenda brown,"...
NetRanger's user avatar
5 votes
2 answers
715 views

I am assuming this is a simple issue, but I don't have any one to double check my work. Here's my bash script #!/bin/bash # establish date format and dump name DATE=$(date +"%Y%m%d-%H%M") ...
Ambre's user avatar
  • 111
0 votes
2 answers
71 views

I am using a dialog in order to modify a single value into a file: #!/usr/bin/env bash prompt_and_save() { local file=$1 local message=$2 local value="" # Check if file ...
Dimitrios Desyllas's user avatar
-1 votes
2 answers
108 views

I need to extract multiple words from git log. I need the commit id and ticket number for each commit, I then need to run this through a loop and do some further processing for each commit. commit ...
xerxes's user avatar
  • 359
0 votes
0 answers
32 views

I commonly want to do something with a bunch of files, so I type in something like: $ for nam in *.c > do > echo $nam > done Aaah, I failed to use upper case C so I go to edit again and ...
user1683793's user avatar
1 vote
1 answer
127 views

I want to copy and synchronize directories using rsync with --delete or --delete-excluded in a bash script or shell on a Debian system. The directory was not synchronized at first, meaning the deleted ...
ReflectYourCharacter's user avatar
0 votes
2 answers
173 views

I'm struggling with the vocabulary here, so I'll ask this way: On an embedded system (Raspberry Pi) I use, there is a command invoked as follows: $ pin-control poll 25 This command "polls"...
Seamus's user avatar
  • 3,928
2 votes
1 answer
489 views

This question is similar to this one but it differs from it: Consider this array with string elements which may contain spaces: a@W:$ arr=("eins" "zwei" "eins plus zwei" &...
Adalbert Hanßen's user avatar
1 vote
1 answer
115 views

I am running various scripts on Debian 12.X currently with the following bash: GNU bash, version 5.2.15(1)-release (x86_64-pc-linux-gnu) I have the following methods/options to execute the script. ...
ReflectYourCharacter's user avatar
0 votes
2 answers
196 views

I'm trying to write a bash script (very new to writing them btw) on a Linux system, and I basically want it to execute a command every say 5 seconds while another command isn't outputting a value. So ...
Tamrak's user avatar
  • 3
-3 votes
1 answer
77 views

There are many files in this format: IMG_20240717_191421.jpg IMG_20240620_165358_BURST001_COVER.jpg IMG_20240624_173513_2.jpg how can they renamed in Linux in Bash to: 20240717_191421.jpg ...
user447274's user avatar
8 votes
1 answer
330 views

I am a long time ksh user, and use bash under duress - both in 'vi' editing mode. One thing that has always niggled - after searching back through history for a command (.e.g <Esc>/needle), how ...
Annihilannic's user avatar
0 votes
5 answers
189 views

There is a folder with many files in it: 112.mkv 123.md5 123.mkv 221.mkv 467.mkv aa1.mkv abc.md5 abc.mkv bbc.mkv dde.md5 dde.mkv ggh.mkv .... xxy.md5 xxy.mkv xxz.mkv How can I move .md5 files and the ...
user447274's user avatar
1 vote
1 answer
121 views

Consider the following commands: $ awk 'BEGIN { system("ed") }' q $ echo hello | awk 'BEGIN { system("ed") }' ? $ In the first case, I was able run ed and then stay in the editor ...
mbigras's user avatar
  • 3,512
1 vote
0 answers
45 views

In bash when I press Alt + . (which is mapped to yank-last-arg), it will switch through arguments I used last to invoke CLI programs. Is there something like a search for it? Something like Ctrl + R ...
glades's user avatar
  • 126
7 votes
2 answers
1k views

I have two systems, the file is the same. It works in openSuse, but having trouble in Ubuntu. The top of the script says: #!/bin/sh -h I updated bash to match on both systems to match what is on ...
Sblu's user avatar
  • 71
0 votes
2 answers
177 views

is it possible to kill/exit the current bash shell and start a new one with some command? Something like kill -9 $PPID && bash -c echo 'I started new!' which does not work obviously.
Juergen's user avatar
  • 101
0 votes
4 answers
170 views

Situation. I work in Cygwin and there is a Windows environment variable that points to one of special folders: ProgramFiles(x86)=C:\Program Files (x86) As you see the variable name contains ...
Mikhail Edoshin's user avatar
5 votes
1 answer
144 views

I am using the following version of the bash: GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu) Man bash states the following for the "group" compound commnad: { list; } list is ...
Yakog's user avatar
  • 517
0 votes
2 answers
69 views

I have a pi cam on a pi zero that needs to run for the whole duration of being on. this pi camera module is being used in stratospheric launch and during our last one we were able to get videos back, ...
purfi's user avatar
  • 1
7 votes
3 answers
1k views

What can I do so that my .bash_history is only aver appended to? I am working in a lot of environments, like singularity, apptainer, docker, podman and ssh with various settings and mounts. Each of ...
KamilCuk's user avatar
  • 970
1 vote
3 answers
184 views

Bash has the built-in command "type", which indicates how each argument would be interpreted if used as a command name, for instance: $ type myfunction myfunction is a function myfunction () ...
ocroquette's user avatar
0 votes
2 answers
249 views

Consider a contrived example using a JSON object such as this, where I want to extract the related id, firstname, and lastname fields for each of many array objects into shell variables for further (...
Chris Davies's user avatar
0 votes
1 answer
77 views

I'm observing a behavior in bash that only happens in my home folder. I haven't been able to reproduce it on any other machine or in any other folder. $ echo --one [--two] --three --one f --three $ # ...
wobtax's user avatar
  • 1,195
0 votes
1 answer
239 views

My bash script is as follows: #!/bin/bash sudo taskset 1 ./program & When running it does nothing. I am able to run the software normally with ./program. I am attempting to do the behavior of &...
WorstCoder4Ever's user avatar
3 votes
2 answers
2k views

On macOS, #!/bin/bash means a script will use the system bash, which is very dated (3.2, 2006 year) and (for myself, at least) mostly useless. Then you can install modern bash using Homebrew or ...
jsx97's user avatar
  • 1,387
3 votes
2 answers
185 views

This is best illustrated with an example I feel: { printf 'foo\nbar\n' ; sleep 2 ; } | grep -m1 foo { printf 'foo\n' ; sleep 2 ; printf 'bar\n' ; sleep 2 ; } | grep -m1 foo Both of these commands, ...
Zorf's user avatar
  • 171
0 votes
2 answers
117 views

Is there a way to pass more than one option when running a script? My script has this case: case "$1" in b) backup_start $1 ;; h) _usage ;; *) echo 'Invalid option, -h for help' ;;...
ancoling67's user avatar
0 votes
0 answers
230 views

I'm in the process of setting up a singe-node Slurm workstation machine and I believe I followed the process closely and everything is working just fine. See below: sudo systemctl restart slurmdbd &...
Matteo's user avatar
  • 387
2 votes
1 answer
204 views

Need to redirect 3 bash code files (possibly more in the future) to SSH, escaping them (within the same SSH session) to execute them on remote host. Perfectly fine to list bash code files manually. ...
strider's user avatar
  • 113
0 votes
1 answer
185 views

I find .env files to be funny things, is there a one line utility to do this: set -o allexport source .env set +o allexport I do not like flipping the shell settings like that, wouldn't it be nice if ...
Alexander Mills's user avatar
1 vote
2 answers
108 views

I have a very slow samba share that i can access through wsl on my windows laptop. On windows accessing the share doesn't take much time but on linux it is in order of seconds. I basically replicate ...
Rouge a's user avatar
  • 11
5 votes
1 answer
162 views

Why does this braced syntax work $ for (( i=0; i<3; ++i )) { echo $i; } 0 1 2 when the manpage says the syntax is for (( expr1 ; expr2 ; expr3 )) ; do list ; done $ bash --version | head -1 # ...
jrw32982's user avatar
  • 1,099

1
3 4
5
6 7
546