简体   繁体   English

无法运行bash cgi脚本

[英]not able to run bash cgi script

#!/bin/bash

printf "Content-type: text/html\n\n"

sudo convert /usr/lib/cgi-bin/images/* /usr/lib/cgi-bin/images.pdf

sudo ocrmypdf /usr/lib/cgi-bin/images.pdf /usr/lib/cgi-bin/pdf/images_ocr.pdf

printf "done"

These lines should be 这些行应该是

sudo convert ~/usr/lib/cgi-bin/images/* ~/usr/lib/cgi-bin/images.pdf
sudo ocrmypdf ~/usr/lib/cgi-bin/images.pdf ~/usr/lib/cgi-bin/pdf/images_ocr.pdf

Without the ~ it's a relative path to the folder in which the script is executed. 没有~它是执行脚本的文件夹的相对路径。

If you already are in cgi-bin and won't change location : 如果您已经在cgi-bin中并且不会更改位置:

sudo convert images/* images.pdf
sudo ocrmypdf images.pdf pdf/images_ocr.pdf

so you're not dependent on your root's folder structure and only on your project's 因此您不依赖于根目录的文件夹结构,而仅依赖于项目的

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM