Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results for bash globstar symlink
Search options not deleted
7 votes
3 answers
2k views

Force Bash 4 'globstar' option to ignore symlinks

Bash 4 has a fantastic option called 'globstar' that emulates (i.e. was stolen from) zsh's ** syntax for globbing across multiple directories. … If not, is there any plan to add this feature to Bash in a future release? Until then (or if there is no such plan), can anyone suggest a decent (and convenient) workaround? …
Kyle Strand's user avatar
5 votes
1 answer
485 views

When does globstar descend into symlinked directories?

In this Ask Ubuntu post, I used globstar to locate a file when PATH is unset: $ shopt -s globstar; for v in /**/vim; do [[ -x $v && -f $v ]] && echo "$v"; done /etc/alternatives/vim /usr/bin/vim /usr/ … From comments: I'm using Bash version 4.4.18(1) on Ubuntu 16.04. …
Olorin's user avatar
  • 4,656
1 vote

Fix File Path Casing

In bash: shopt -s nocasematch globstar for f in **; do for search in "${files[*]}"; do [[ $f == $search ]] && echo Found "$search" at: "$f"; done; done The nocasematch shell option tells the [[ ... … The globstar shell enables the ** brute-force bash emulation of find; it differs from find in that it will skip dot-files (unless shopt -s dotglob is set) and follows symlinks. …
Jeff Schaller's user avatar
  • 66.7k
4 votes

Get list of all files by mask in terminal

In bash, turn on the globstar option so that ** matches any level of subdirectories. You can do this from your ~/.bashrc. Also turn on the extglob options to activate ksh extended patterns. … shopt -s globstar extglob Then: grep PATTERN **/trunk/src/**/*.@(h|cpp) Beware that bash versions up to 4.2 follow symlinks to directories when you use **. …
Gilles 'SO- stop being evil''s user avatar
14 votes

How to copy a file with unique name without navigating to directory?

With zsh or fish or ksh -o globstar or bash -O globstar (or after shopt -s globstar in bash) or tcsh after set globstar or yash -o extended-glob: cp -- **/Screenshot20180509143*3.png /dev/media/SD256/ … Note that: fish and versions of bash prior to 4.3 will following symlinks when recursing. With zsh, tcsh or yash, you can use *** instead of ** to get that behaviour. …
Jeff Schaller's user avatar
  • 66.7k
3 votes
Accepted

When does globstar descend into symlinked directories?

tl;dr - Bash expansion is complicated to prevent infinite symlink loops (in bash >= 4.3), and you and I both misinterpreted what it was doing in the commands you posted I assume you have bash >= 4.3 as … From the documentation for bash shopt: globstar If set, the pattern ‘**’ used in a filename expansion context will match all files and zero or more directories and subdirectories. …
cunninghamp3's user avatar
1 vote

Bash script error with strings with paths that have spaces and wildcards

Use l instead of d to skip symlink-files. • -maxdepth 1 : is configuring it to find files within current (aka: one) directory level only. … . extglob : If set, the extended pattern matching features described above (see Pattern Matching) are enabled. globstar : If set, the pattern ‘**’ used in a filename expansion context will match all files …
atErik's user avatar
  • 171