Sh add all files from a folder to an array

I am trying to use an array to store all txt files from a folder that have a name which do not contain “silent” word. Until now, I tried the following commands, but with no succes:

ACTIVE_LOGS=($(`find $DEST_DIR -name '*.txt'  '!' -name '*silent*'`))
ACTIVE_LOGS=($("find $DEST_DIR -name '*.txt'  '!' -name '*silent*'"))

I have to mention that the following command works as expected:

ACTIVE_LOGS=`find $DEST_DIR -name '*.txt'  '!' -name '*silent*'`

but i need an array instead of a variable.


Source: unix

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.