我编写了一个bash脚本,它根据接收到的数据对MythTV文件进行重命名。我用bash编写它,因为bash具有文本数据操作和易用性的优点。
您可以在此处查看脚本本身:http://code.google.com/p/mythicallibrarian/source/browse/trunk/mythicalLibrarian
我有几个用户是第一次使用Linux。我在这里创建了一个安装脚本,它检查依赖项并以图形方式进行设置。您可以在此处查看设置脚本:http://code.google.com/p/mythicallibrarian/source/browse/trunk/mythicalSetup.sh
最近,对MythTV的一些更改要求我将mythicalLibrarian中的mysql数据库访问迁移到Python绑定脚本。这里:http://code.google.com/p/mythicallibrarian/source/browse/trunk/pythonBindings/MythDataGrabber
以前,我曾使用这样的系统测试过依赖关系:
test "`uname`" != "Darwin" && LinuxDep=1 || LinuxDep=0
if which agrep >/dev/null; then
echo "Verified agrep exists"
else
test "$LinuxDep" = "1" && echo "Please install 'agrep' on your system" || echo "Please obtain MacPorts and install package agrep"
d="agrep "
fi
.........................
if which agrep>/dev/null && which curl>/dev/null && which dialog>/dev/null; then
echo "All checks complete!!!"
else
echo "the proper dependencies must be installed..."
echo "The missing dependencies are $a$b$c$d$e"
test "$LinuxDep" = "1" && echo "Debian based users run: apt-get install $a$b$c$d$e" || echo "Please obtain MacPorts and run: port install $a$b$c"
if [ "$LinuxDep" = "0" ]; then
read -n1 -p " Would you like some help on installing MacPorts? Select: (y)/n" MacPortsHelppython的依赖关系使它变得更加困难。我不知道如何测试系统上是否有linux包"libmyth-python“和"python-lxml”。
如何在BASH中测试我的Python脚本MythDataGrabber是否有其
from MythTV import MythDB满足要求了吗?
发布于 2010-10-25 04:13:27
您可以查看以下状态码:
python -c "import MythDB.MythTV"如果它返回非零值,则说明发生了错误,很可能是ImportError。
发布于 2010-10-25 04:12:54
编写一个Python脚本:
try:
from MythTV import MythDB
print "Yes"
except ImportError:
print "No"然后从Bash脚本运行Python脚本,并检查其输出。
https://stackoverflow.com/questions/4010200
复制相似问题