Questions specific to GNU’s Bourne Again SHell, as opposed to other Bourne/POSIX shells. For questions about Unix shells in general, use the /shell tag instead.

learn more… | top users | synonyms

0
votes
1answer
20 views

for loop problem, detect file with size and copy regardless of name

The situation: I want to copy all odt files with size greater than 0 from one folder into another. Filenames will contain the following characters: + % & [ ( and spaces. Here is my attempt: ...
0
votes
0answers
4 views

unable to adjust screen brightness in kali linux ASUS ROG

With a great difficulty i managed to install kali-linux on to my ASUS-ROG but now i am not able to adjust brightness of my computer. My brightness keys and fn key both are working fine. I checked them ...
5
votes
1answer
113 views

never use the `-a` or `-o` operator with `[`

Stéphane Chazelas wrote: a few rules like always quote variables never use the -a or -o operator (use several [ commands and the && and || shell operators) Make [ ...
0
votes
1answer
17 views

What does the comma operator do in Bash arithmetic?

In Bash Manual, sec 6.5 Shell Arithmetic expr1 , expr2 comma What does the comma operator do? Are expr1 and expr2 arithmetic expressions?
0
votes
1answer
19 views

How can I source several files into my .bashrc?

I want to write my functions each in separate files, for easier version control, and source the whole lot of them in my .bashrc. Is there a more robust way than e.g. . ~/.bash_functions/*.sh ?
1
vote
1answer
16 views

How is the return status of a variable assignment determined?

I have seen constructs in scripts such as this: if somevar="$(somecommand 2>/dev/null)"; then ... fi Is this documented somewhere? How is the return status of a variable determined and how does ...
0
votes
1answer
25 views

Places in Bash where pattern matching is done by regex?

There are several places in Bash where pattern matching is used. Is pattern matching in Bash done either by regex, or by globbing (same style as in filename expansion)? In Bash, is pattern matching ...
2
votes
1answer
33 views

Are “filename expansion” and “pathname expansion” the same thing in Bash?

Bash Reference Manual sometimes mentions "filename expansion" and sometimes but less often "pathname expansion". I have been thinking they are the same concept. But the same manual mentions the two ...
0
votes
1answer
25 views

Redirection Error in Function [on hold]

I'm trying to figure out why the code below doesn't work, and gives me an error Bad file descriptor. It is sort of a follow-up to this question as applies to the script I'm currently working on. ...
3
votes
3answers
50 views

How can an unquoted metacharacter be part of a token?

I was looking through the bash man page after reading through some of @Tim's questions about shell grammar, and I came up with a (simple) question of my own. Here is an excerpt from man bash (see it ...
0
votes
3answers
49 views

How to write exactly bash scripts into Makefiles?

I love to type bash scripts, but if I prepare multiple programs, project's root directory is filled with so many shell scripts. That's why I prefer using Makefile. Makefile is good. But I want to ...
1
vote
3answers
181 views

How come root can do this, but sudo can't? [duplicate]

I am set up as a sudoer on my Debian machine, and I use it all the time to install software etc... I came across this interesting situation that I am scratching my head about: I tried to enable the ...
0
votes
0answers
28 views

Are there Bash's Choices: builtin commands vs operators? [on hold]

I have found that there are several similar choices in shell languages' design (taking Bash as an example): choose something as a reserved word or a builtin command choose something as a reserved ...
1
vote
0answers
29 views

Bash's choice: operator vs reserved word

In Bash, I notice that there are some examples of choosing something as an operator or a reserved word: (all quotes are from Bash Manual) (...) and {...}: They are both used for creating a list ...
2
votes
2answers
68 views

Returning a String and Understanding Redirection and Output

I'm trying to figure out how redirects could be used to selectively output a string from a bash function which needs to print multiple lines to the terminal. I found an answer on this question at ...

15 30 50 per page