本文主要记录一次G站下载的问题排查过程
因为某些原因我需要一个去除PDF水印软件
在GitHub上我找到了pdf-unstamp from hwding
Thanks for hwding
我使用VMware for win10的Ubuntu18.04作为操作环境
在运行
sudo bash -c "$(curl -s https://raw.githubusercontent.com/hwding/pdf-unstamper/master/script/install)"
时发生报错
command not found
尝试
sudo su
curl -s https://raw.githubusercontent.com/hwding/pdf-unstamper/master/script/install | bash
和
bash -c "$(curl -s https://raw.githubusercontent.com/hwding/pdf-unstamper/master/script/install)"
发生空响应:
在检查完curl 和 wget Ubuntu 的版本
无问题后,尝试查询PATH:
winner@ubuntu:~$ which bash
/bin/bash
winner@ubuntu:~$ which sudo
/usr/bin/sudo
winner@ubuntu:~$ which wget
/usr/bin/wget
winner@ubuntu:~$ which curl
/usr/bin/curl
PATH正常,考虑网址本身的问题:
(在查询command not found的问题过程中遇到的大部分的解答都是修改PATH,而忽略环境本身的问题,私认为应该具体情况具体分析)
https://raw.githubusercontent.com/hwding/pdf-unstamper/master/script/install
发现:
该网址使用win10可以打开,但使用Firefox for Ubuntu无法打开
(但R哥的Linux一开始就可以打开)
(我使用curl -v 和 ping 和 telent 来检查是否可访问对方服务器)
之后我选择改用直接复制粘贴网页.sh文件的形式
将网页上的:
#!/bin/bash
#AUTH hwding
#DATE Feb 19 2019
#DESC install unstamp as a command
user_bin=`echo ~`"/bin/"
locl_bin="/usr/local/bin/"
jar_name="pdf-unstamper.jar"
exe_name="unstamp"
_version="0.2.5"
jar_durl="https://github.com/hwding/pdf-unstamper/releases/download/$_version/$jar_name"
wrapper="#!/bin/bash\njava -jar ${user_bin}${jar_name} \"\$@\"\n"
# default option(s)
create_link=1
# check if the script is running in root
if [ ! $UID -eq 0 ]; then
echo -e "$(tput setaf 1)> plz run this script in root permission$(tput sgr 0)"
exit -1
fi
# parse option(s)
while getopts ":d:w" opt; do
case "${opt}" in
w)
create_link=0
;;
d)
given_dir="${OPTARG}"
# complete the slash at the end of the given directory
[[ "${given_dir: -1}" == "/" ]] &&