使用shell获取字符串的问题

时间:2016-11-08 17:36:14

标签: bash shell

我需要获取从linux shell中的文件获取的文件名的长度。这是我的代码:

#!/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

但是当我运行bash文件时,我得到:

./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

请帮我解决问题。

0 个答案:

没有答案