1

I need to get the lenght of a filename obtained from a file in linux shell. This is my code:

#!/bin/bash

locate /var/log/orkaudio/ | grep ".wav" | grep -v left | grep -v right > ficherosOrkAudio.txt

while read filePath  ; do

            filePathLenght = ${#filePath}
            echo $filePathLenght
done <ficherosOrkAudio.txt

But when i run the bash file, i get:

./procesoTest: line 6: filePathLenght: command not found

./procesoTest: line 6: filePathLenght: command not found

./procesoTest: line 6: filePathLenght: command not found

./procesoTest: line 6: filePathLenght: command not found

./procesoTest: line 6: filePathLenght: command not found

./procesoTest: line 6: filePathLenght: command not found

./procesoTest: line 6: filePathLenght: command not found

Please help me realize problem.

  • The site `shellcheck.net` will help you find many mistakes, use it !! –  Nov 08 '16 at 21:05

0 Answers0