Skip to main content
deleted 3 characters in body; edited tags
Source Link
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 266

This works:

if [ /a/*/b/file.asd -nt /c/d/file.asd ]; then echo "found new file"; fi 

This doesntdoesn't work:

if [[ /a/*/b/file.asd -nt /c/d/file.asd ]]; then echo "found new file"; fi 

Can someone please explain why /*/ is not working with double brackets  ? :)

This works:

if [ /a/*/b/file.asd -nt /c/d/file.asd ]; then echo "found new file"; fi 

This doesnt work:

if [[ /a/*/b/file.asd -nt /c/d/file.asd ]]; then echo "found new file"; fi 

Can someone please explain why /*/ is not working with double brackets  ? :)

This works:

if [ /a/*/b/file.asd -nt /c/d/file.asd ]; then echo "found new file"; fi 

This doesn't work:

if [[ /a/*/b/file.asd -nt /c/d/file.asd ]]; then echo "found new file"; fi 

Can someone please explain why /*/ is not working with double brackets?

This works: if [ /a/*/b/file.asd -nt /c/d/file.asd ]; then echo "found new file"; fi

if [ /a/*/b/file.asd -nt /c/d/file.asd ]; then echo "found new file"; fi 

This doesnt work: if [[ /a/*/b/file.asd -nt /c/d/file.asd ]]; then echo "found new file"; fi

if [[ /a/*/b/file.asd -nt /c/d/file.asd ]]; then echo "found new file"; fi 

Can someone please explain why /*//*/ is not working with double brackets ? :)

This works: if [ /a/*/b/file.asd -nt /c/d/file.asd ]; then echo "found new file"; fi

This doesnt work: if [[ /a/*/b/file.asd -nt /c/d/file.asd ]]; then echo "found new file"; fi

Can someone please explain why /*/ is not working with double brackets ? :)

This works:

if [ /a/*/b/file.asd -nt /c/d/file.asd ]; then echo "found new file"; fi 

This doesnt work:

if [[ /a/*/b/file.asd -nt /c/d/file.asd ]]; then echo "found new file"; fi 

Can someone please explain why /*/ is not working with double brackets ? :)

Source Link

Bash * directory wildcard not working in if statement using double brackets

This works: if [ /a/*/b/file.asd -nt /c/d/file.asd ]; then echo "found new file"; fi

This doesnt work: if [[ /a/*/b/file.asd -nt /c/d/file.asd ]]; then echo "found new file"; fi

Can someone please explain why /*/ is not working with double brackets ? :)