我在 .bashrc 中定义了一个名为 groovy 的函数。
我有这个 bash 脚本,我想在其中使用 groovy。
它说./batch.sh: line 7: groovy: command not found
虽然我在脚本开头引用了 .bashrc。
我错过了什么?
批处理文件
#!/usr/bin/env bash
source ~/.bashrc
for file in *.html;
do
name="${file%.html}"
groovy "$name.html" "uncached/$name.mp3"
done;
.bashrc 的一部分
function groovy {
sed -n '/<pre>/,/<\/pre>/p' "$1" | replace '<pre>' '' '</pre>' '' | hextomp3 - "$2"
}
function hextomp3 {
echo "in $1"
echo "out $2"
echo "cut -c10-74 $1 | xxd -r -p - $2"
cut -c10-74 "$1" | xxd -r -p - "$2"
}
输出 :
chaouche@karabeela ~/DOWNLOADS/MUSIQUE $ ./batch.sh
./batch.sh: line 6: groovy: command not found
./batch.sh: line 6: groovy: command not found
./batch.sh: line 6: groovy: command not found
./batch.sh: line 6: groovy: command not found
./batch.sh: line 6: groovy: command not found
./batch.sh: line 6: groovy: command not found