What's the reason lpadmin gives completely different results when running it as root and when running it inside a script and executing it as root? Looks like it is not having the same scopes for files access.
My script:
#!/bin/bash
lpadmin -p printer-x -E -v socket://192.168.0.111 -P /root/tm-ba-thermal-rastertotmt.ppd
lpadmin -p printer-x -m raw
cupsenable printer-x
Results when running as a script:
lpadmin: No such file or directory
lpadmin: Unable to copy PPD file!
cupsenable: Operation failed: client-error-not-found
Results when running the commands outside the script (no errors outputs are shown and the printer is added):
[root@localhost ~]# lpadmin -p printer-x -E -v socket://192.168.0.111 -P /root/tm-ba-thermal-rastertotmt.ppd
[root@localhost ~]# lpadmin -p printer-x -m raw
[root@localhost ~]# cupsenable printer-x
I've given full permissions on the script and folders for testing, but it does not look like to be the issue. I've tried moving to other folders too.
I've also tried to isolate each command from the script, but all of the commands are answering the same errors on the output.