Home > Back-end >  tree negative pattern not working with watch
tree negative pattern not working with watch

Time:12-24

I want to watch the tree structure of a directory.

If I call tree -L 2 -I '*vfp*' all is well and I see no directories

.

0 directories, 0 files

...but if I try and watch tree -L 2 -I '*vfp*' I see everything without the effect of -I

Every 2,0s: tree -L 2 -I *vfp*                                                                                                                   

vfp-directory
├── ckpts
├── data
│   ├──  100.wav
│   ├──  101.wav
│   ├──  102.wav
...

What am I missing here? How can I watch the directory and see the same as what I see with a bare call to tree?

CodePudding user response:

When you do :

watch tree -L 2 -I '*vfp*'

What watch sees is :

tree -L 2 -I *vfp*

So you need to do

watch tree -L 2 -I "'*vfp*'"

CodePudding user response:

I believe you have to escape your single quotes:

watch tree -L 2 -I \'*vfp*\'

  •  Tags:  
  • bash
  • Related