Whats up guys? I am trying to make a script do something that might seem strange to you but I think it will be cool when I am all done. I have almost no script making skills but what I am trying to do isn't hard. I place the script into /usr/bin and call it lpr, the script code follows:
cp $1 /print/
simple enough right? all i want it to do is when i want to print someting (anything) it copys the file into the directory /print/ instead of actually printing anything. For some reason it's not working. I can do it but only if im in the /usr/bin directory. I can "lpr (name of file)" and it works fine of course when i am in /usr/bin, but if im at ~/ or something it says "Cant open lpr." Also when I use gui programs like abiword or mozilla i dont know what happens but the file doesnt end up in /print/ when i push the print button.
Any help would be good. thanks.
need a little help making a script.
- Pizzasgood
- Posts: 6183
- Joined: Wed 04 May 2005, 20:28
- Location: Knoxville, TN, USA
Sounds to me like you need to use "/usr/bin/lpr (name of file)" instead of "lpr (name of file)"
Sometimes it just works like that
Sometimes it just works like that
[size=75]Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib[/size]
[img]http://www.browserloadofcoolness.com/sig.png[/img]
[img]http://www.browserloadofcoolness.com/sig.png[/img]
to see what is happening, try putting this in the /usr/bin/lpr script:
Code: Select all
#!/bin/sh
echo "cp $1 /print/" >> /tmp/lpr.txt
xmessage -center "cp $1 /print/"