shopt Questions
8
Solved
I have updated my shell to ZSH. When I source ~/.bashrc. I am getting this error
There was some error in yo doctor .
when i execute this command
echo "export NODE_PATH=$NODE_PATH:/usr/local/li...
3
Solved
I can't get expand_aliases to take effect in bash. I've tried a lot of different things, and nothing works.
Here's the simple test case:
/bin/bash -c 'shopt -s expand_aliases; alias cdtmp="cd /tm...
4
Solved
I'm trying to write a bash function that uses nocasematch without changing the callers setting of the option. The function definition is:
is_hello_world() {
shopt -s nocasematch
[[ "$1" =~ "hell...
2
I want to loop over all files matching extension jpg or txt. I use:
for file in myDir/*.{jpg,txt}
do
echo "$file"
done
Problem: If the directory contains no jpg file at all, the loop will...
0
Running vscode on Mac. I updated the Mac bash version and, as you can see the built-in vscode terminal shows the same version of bash as that of the Mac terminal. When I source my .bash_profi...
Alejandrinaalejandro asked 8/3, 2019 at 16:13
5
Solved
1
Solved
How to disable a shopt option, for example extglob?
I have this in my .bashrc file:
shopt -s extglob
2
Solved
If a glob pattern doesn't match any files, bash will just return the literal pattern:
bash-4.1# echo nonexistent-file-*
nonexistent-file-*
bash-4.1#
You can modify the default behavior by settin...
5
Solved
In bash, if you do this:
mkdir /tmp/empty
array=(/tmp/empty/*)
you find that array now has one element, "/tmp/empty/*", not zero as you'd like. Thankfully, this can be avoided by turning on the ...
2
I cannot figure it out, i understand shopt -s cdspell but cannot find out what shopt -s dirspell does.
The Bash Reference Guide says:
dirspell
If set, Bash attempts spelling correction on direct...
6
Solved
Is there a way to use shell globbing to identify nested directories?
so if I have dir/dir1/dir2/dir3/dir4/dir5/.. and I have files under all of them, what is the equivalent globbing pattern to mat...
2
When I loop through all the files starting by foo I do
for f in foo* ; do echo "result = $f" ; done
The problem is when no file start by foo I get:
result = foo*
Meaning that the loop is exec...
1
Solved
I put the following unsuccessfully to my .bashrc
shopt -s globstar
I am trying to test the command in action by
ls **/*.c
and by comparing it to
ls */*/*.c
How can you enable globstar in B...
1
© 2022 - 2024 — McMap. All rights reserved.