All Questions
85 questions
2
votes
2
answers
93
views
Merging values from 2 YAML files in bash
A bash command:
$(System.DefaultWorkingDirectory)/yq_linux_amd64 '. *= load("${{ parameters.HELM_CHART_PATH }}/values/DEV/${{ parameters.COMPONENT }}.yaml")' ${{ parameters.HELM_CHART_PATH }}...
5
votes
1
answer
100
views
Why can a list within a group be terminated with a space instead of a semicolon/newline as defined in the manual?
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 ...
0
votes
4
answers
88
views
Details with bash's syntax checking and breaking over several lines
There are two cases in which I do not understand why bash behaves as it behaves regarding syntax checking and asking for a newline.
Case 1
bash can execute the line ( (ls) | cat), but depending on ...
2
votes
1
answer
62
views
Get PID of command in one line bash script [duplicate]
When trying to get the PID of a shell command, it is possible using a script file:
#!/bin/bash
ls -lha &
echo "$!"
However, it is not possible using only the terminal.
/bin/bash -c 'ls ...
0
votes
1
answer
903
views
bash 5.2.x + ternary operator: How can I use this combo when checking if my string variable is empty or not?
I have tried
#!/bin/bash
distro=""
myvar1=[[ -n "$distro" ]] && echo $distro || echo "debian"
myvar2=$((-n $distro ? $distro : "debian"))
these are ...
0
votes
2
answers
129
views
mv multiple files on Linux vs. on Mac
To move multiple files on Linux, one could use:
mv -t DESTINATION file1 file2
Whereas on macOS it is
mv file1 file2 DESTINATION
Why is this difference? Is this a Bash vs. Zsh thing, or older vs. ...
1
vote
1
answer
98
views
Is there a way to make a comment after a "\" has been used to split a shell command onto differemt lines? [duplicate]
I am using arch and bash. Everything is up to date.
I have this command which works just fine
yad \
--timeout=2 \
--undecorated \
--posx=1200 --posy=633 \
--title=" " \
--window-icon='/home/$...
4
votes
2
answers
220
views
How to make the (N) patterns of the zsh eatable by bash?
I am trying to develop a script which runs (and, ideally, does the same :-) ) in zsh and Bash. Problem is, that at a point, the zsh-specific part contains a pattern ending with (N). So: this_pattern*(...
-3
votes
1
answer
81
views
What's "[@]" doing to variable in bash for loop
I was looking at how Gentoo's ebuilds are made and I found the following code:
_VIM_PLUGIN_ALLOWED_DIRS=(
after autoload colors compiler doc ftdetect ftplugin indent keymap
macros plugin spell ...
-1
votes
1
answer
123
views
What is "in" in Bash?
I have encountered this in the syntax for case after calling help case and getting case WORD in [PATTERN [| PATTERN]...) COMMANDS ;;]... esac.
There was a question, whether "in" is a bash ...
6
votes
3
answers
1k
views
What does \ mean in bash and find?
I know that \ is an escape character, but when I write \ in bash, I have something like this:
System-Product-Name:~$ \
>
So bash waits for some instructions?
When I use
System-Product-Name:~$ \
&...
0
votes
1
answer
270
views
What are * and / in Bash?
I was trying to understand the following code ls -d */ and came to the explanation that */ "matches all of the subdirectories in the current directory". But that answer points out, what this ...
0
votes
2
answers
148
views
Dangers of executable file with '#' in name?
This might be a FAQ--happy to have the question closed if it's a dupe--but I'm not sure how to find it if so. I'd also be happy with an answer that simply told me how to find the relevant ...
-1
votes
2
answers
553
views
Test for a number in bash [duplicate]
Is this the correct way to test for a number, with double [[]] enclosing :digit: and single quotes surrounding the regex ?
if [[ "$var" =~ '^[[:digit:]]+$' ]]; then
0
votes
1
answer
94
views
Compact form of a bash file extension test condition
I am testing whether arguments are not video files (.mp4, .mkv). Can I clean this so as to make it more compact test.
if [[ ! "$1" == *.mp4 || ! "$1" == *.mkv ]]; then