I am trying to write a .sh
script where at a certain point it checks if there are one or more files in the current directory matching *\_??\_??\_64kbs.mp3
OR, using regex ^.*\_..\_..\_64kbs\.mp3$
This is one attempt at the command:
if [ 'ls *_??_??_64kbs.mp3 2>/dev/null | wc -l ' == 0 ];
then echo "nothing";
else echo "something";
fi
I know that
'ls *_??_??_64kbs.mp3 2>/dev/null | wc -l'
in this case returns just the number 9 to the terminal, because there are 9 matches. If I remove the first '?', it then returns 0, like it should because there are no file names matching that expression. But the output of the if expression above is always "something".
EDIT: Someone asked for a complete sample file name for what I'm trying to match. Here's one:
George-1983_1A_01_64kbs.mp3