Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 09-03-2006, 01:25 PM   #1
Registered: Feb 2004
Distribution: Ubuntu
Posts: 316

Rep: Reputation: 30
extracting a .sh file - trap?

First of all let me say I'm running Slackware 10.2. I'm trying to get some drivers for my Dell Photo Printer 720 and I've read it's just a repackaged Lexmark z600 series. Lexmark has some linux drivers for the z600 series but of course they're meant for RedHat systems. I extract the tar.gz and get a file called which the readme says is extracted by giving the command 'sh'. However when I run that command, I get
Verifying archive integrity...OK
Uncompressing Lexmark Printer Drivertrap: usage: trap [-lp] [arg signal_spec ...]
There seems to be a lack of documentation for trap becuase 'man trap' gives me no information nor has searching turned up much info. I'm still pretty clueless as to how the trap command even works and why it's related to executing this .sh. Once I get this file extracted, I have the rpms that I Can convert to .tgz and install and hopefully get this printer working!
Old 09-03-2006, 02:10 PM   #2
Registered: Oct 2004
Distribution: Slackware
Posts: 376

Rep: Reputation: 31
trap is a shell builtin, sometimes used in shell scripts (it's apparently used in this one). You can find documentation about it in the bash manpage. The trap command is used to trap certain signals such that they execute commands or parts of the script rather than their default action, such as stopping or ending the script. Here is an excerpt:
 trap [-lp] [[arg] sigspec ...]
              The command arg is to  be  read  and  executed  when  the  shell
              receives  signal(s)  sigspec.   If arg is absent (and there is a
              single sigspec) or -, each specified  signal  is  reset  to  its
              original  disposition  (the  value  it  had upon entrance to the
I can't imagine why a driver installer script would need to trap any signals of any kind.

EDIT: I just downloaded the driver myself to check the script out. Apparently, it's using trap to execute some cleanup of its temporary files from your /tmp directory. When the program is forcefully closed for any trappable reason, it will quickly erase its temporary files before exiting.

Last edited by zhangmaike; 09-03-2006 at 02:19 PM.
Old 09-03-2006, 02:45 PM   #3
Registered: Oct 2004
Distribution: Slackware
Posts: 376

Rep: Reputation: 31
Installing the Lexmark Z600 drivers on Slackware 10.2 (HOW-TO)

Download and extract the archive from the Lexmark site.

Run (as a NON-root user):
$ bash -keep
Using bash instead of sh will (for some reason) not kill the script when that trap usage problem is encountered. The script WILL exit with an error about the libtcl library (Slackware has a newer version), but because of the -keep option, the installer's files will be kept in /tmp and in ./installer

Now just cd into the installer directory, convert the z600*-cups.rpm to z600*-cups.tgz with rpm2tgz, and installpkg as root. Then, restart the CUPS scheduler and you're all set:
$ cd installer
$ rpm2tgz z600cups-1.0-1.i386.rpm
$ su
# installpkg z600cups-1.0-1.i386.tgz
# /etc/rc.d/rc.cups restart
You'll still have to configure your printer through the CUPS web-interface, of course, but at least the driver is installed.

It'd have been nice if Lexmark had simply included the driver file and instructions rather than a non-functional, distribution-specific GUI install.

Last edited by zhangmaike; 09-03-2006 at 02:47 PM.


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
how to send snmp trap & recieve trap in C program minil Programming 3 07-10-2010 09:22 AM
Kernel trap (Fatal trap 12) m!k@EL *BSD 4 09-05-2007 11:58 PM
extracting gz file..... b123coder Linux - Newbie 1 11-21-2004 07:55 AM
extracting 1 file from RPM sopiaz57 Linux - General 3 04-09-2004 03:22 PM
extracting this file... Xylicon Linux - General 4 01-23-2003 08:49 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:45 PM.

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