I have a variable named $lsoutput
in which I store the result of the ls -l
command
It's content is
- -rw-r--r-- 1 root ftp 44 Apr 29 2003
first_file.txt
- I would like to get the size of that file.
- I useed the following regular expression
if [[ "$lsoutput" =~ ^[-rwx]{10}[[:space:]][[:digit:]]+[[:space:]][[:alnum:]]+[[:space:]][[:alnum:]]+[[:space]]([[:digit:]]+) ]]
echo ${BASH_REMATCH[1]}
fi
Unfortuantely this regexp does not work. What is wrong with it? Can you provide a correct one? Thanks for your help