通过串联变量不起作用而修改的文件路径
我正在尝试做这项工作。请帮忙。
folder="Test\ Folder"
path="/Volumes/Macintosh\ HD/Users/Shared/${folder}"
echo "$path"
if [ -d "$path" ]; then
echo "Yes"; else echo "No"
fi
这是我正在创作的原始脚本。
echo in point
read inp
echo out point
read op
echo path
read ffolder
fName=`echo "$ffolder" | cut -d'/' -f1`
makejpgs () {
ffmpeg -y -i "${3}" -ss $1 -to $2 -vf fps=12 "$fName_%d.jpg"
}
path="/Volumes/PROJECTS/Main/${fName}"
files=$(find "$path" -type f -name "*story*")
echo "$files"
for i in $files; do
echo "$i"
makejpgs "$inp" "$op" "$i"
done
FFMPEG在不使用\
时给出错误。
I'm trying to make this work. Please help.
folder="Test\ Folder"
path="/Volumes/Macintosh\ HD/Users/Shared/${folder}"
echo "$path"
if [ -d "$path" ]; then
echo "Yes"; else echo "No"
fi
This is the original script I'm working on.
echo in point
read inp
echo out point
read op
echo path
read ffolder
fName=`echo "$ffolder" | cut -d'/' -f1`
makejpgs () {
ffmpeg -y -i "${3}" -ss $1 -to $2 -vf fps=12 "$fName_%d.jpg"
}
path="/Volumes/PROJECTS/Main/${fName}"
files=$(find "$path" -type f -name "*story*")
echo "$files"
for i in $files; do
echo "$i"
makejpgs "$inp" "$op" "$i"
done
ffmpeg giving error when not using \
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您有一个值
“引号之间”
,则您需要不是需要逃脱\ spaces
。因此,将每个\
更改为。
If you have a value
"between quotes"
, then you do not need toescape\ spaces
. So, change each\
into just.
您可以逃脱输入中的特殊字符。
在
的输入上,我的桌面
它将返回我的\ desktop
,同样是[我的文件夹]
它将返回\ [我的\文件夹\]
。You can escape special characters in your input.
On input of
my desktop
it will returnmy\ desktop
and similarly for[my folder]
it will return\[my\ folder\]
.