【发布时间】:2018-09-13 13:37:20
【问题描述】:
我有一个文件夹路径存储在变量 ${PROJECT_DIR} 中。 我想向上导航到其父文件夹,然后返回到名为 "Texture Packer" 的文件夹,即 ${PROJECT_DIR} 和 "Texture Packer" 是兄弟姐妹。 如何在 shell 脚本中指定它? 到目前为止,我有:
TP=/usr/local/bin/TexturePacker
# create all assets from tps files
${TP} "${PROJECT_DIR}/../Texture Packer/*.tps"
但这是不正确的,因为 Texture Packer 无法检测到路径中的文件。错误信息显示:
TexturePacker:: 错误:无法打开文件 /Users/john/Documents/MyProj/proj.ios_mac/../Texture Packer/*.tps 阅读:没有这样的文件或目录
编辑:以下似乎有效但不干净:
#! /bin/sh
TP=/usr/local/bin/TexturePacker
if [ "${ACTION}" = "clean" ]
then
# remove sheets - please add a matching expression here
# Some unrelated stuff
else
cd ${PROJECT_DIR}
cd ..
cd "Texture Packer"
# create all assets from tps files
${TP} *.tps
fi
exit 0
【问题讨论】:
标签: shell unix osx-elcapitan