LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 01-09-2005, 06:13 AM   #1
erraticassassin
Member
 
Registered: Feb 2004
Distribution: Slackware 13.1
Posts: 127

Rep: Reputation: 18
Permanent Command Aliases - Slackware 9.1


Hi all,

I'd like to set up a couple of permanent command aliases on a laptop running Slackware 9.1. As I understand it, global command aliases should be added to the /etc/profile file in order to make them permanent and have them available to all users. So, I added these lines:

alias dtp="lpr -o page-left=72 page-right=72 page-top=72 page-bottom=72 cpi=12"
alias wallpaper="display -geometry 800x600+0+0 -window root"

The first command is to dump a plain text file to my printer with one inch margins and 12 characters per inch ( I use CUPS as my print spooler). The second is to set a desktop wallpaper - I use fluxbox and the default wallpaper utility, fbsetbg, keeps generating errors.

So... having added these lines to the /etc/profile file, I logged out and logged back in again. Testing the dtp command results in an error message stating that the directory page-left=72 couldn't be found.

As for the wallpaper command - I tested it first in a plain text console and got an error message saying that the X Server wasn't running. This is fine - it implies that the alias was at least recognised. However, once I started X and tried the command from an xterm, it wasn't recognised.

Can anyone provide any hints as to where I'm going wrong?
 
Old 01-09-2005, 06:33 AM   #2
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 242Reputation: 242Reputation: 242
For xterm, try to start it with :
xterm +ls

(ls = login shell, so /etc/profile is loaded)

for the dtp alias, you may have to quote the option

lpr_opts="-o 'page-left=72 page-right=72 page-top=72 page-bottom=72 cpi=12'"
alias dtp="lpr $lpr_opts"

Did you test your lpr command with these options to see if it works before ?

[edit]
Just checked the xterm option, it works with :
xterm -ls

Last edited by Cedrik; 01-09-2005 at 06:39 AM.
 
Old 01-09-2005, 09:41 AM   #3
erraticassassin
Member
 
Registered: Feb 2004
Distribution: Slackware 13.1
Posts: 127

Original Poster
Rep: Reputation: 18
Hi Cedrik,

Yes, I have tried the lpr command with all of the options and it worked fine before. I had to enclose the options in quote marks, but it worked. If I understand correctly, your suggestion is to store the options in a global variable, then invoke the command using the variable? I'll give it a bash anyway* and see what happens. I'll also try the xterm suggestion. Thanks!


* Ouch! No pun intended.
 
Old 01-09-2005, 03:08 PM   #4
erraticassassin
Member
 
Registered: Feb 2004
Distribution: Slackware 13.1
Posts: 127

Original Poster
Rep: Reputation: 18
Update: I have amended my /etc/profile file as suggested, and both aliases work perfectly.

Caution! For anyone else reading this, please note the single quotes inside the double quotes in Cedrik's suggestion for lpr, on the line beginning lpr_opts. It won't work without them. See, my laser printer is a cheap ol' Samsung and has a tendency to leave flecks of toner on the printout... and I thought the single quotes were toner flecks at first, and ... mumble mumble mumble...

Anyway! All is right with the world now...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Permanent Alias In Slackware dmcbeing Linux - Software 2 11-10-2005 11:18 AM
Permanent aliases Acetylcholine Slackware 6 01-06-2005 03:29 PM
making aliases via command line MACSRULE *BSD 1 04-07-2004 03:14 PM
Making Changes Permanent T-u-N-i-X Linux - General 1 09-01-2003 05:47 AM
getting permanent color for ls? JapKraut Linux - Newbie 7 09-13-2001 09:43 AM


All times are GMT -5. The time now is 03:35 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration