Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 12-01-2009, 12:30 PM   #1
Registered: May 2007
Location: Bulgaria
Distribution: Slackware, SCO Unix
Posts: 62

Rep: Reputation: 20
Cups texttops wrapper

Hello, Im trying to create simple wrapper to texttops. It's goal it to determine if there is global CHARSET variable, and if not to extract one from LANG variable. The problem is how, can I redirect stdin (if there is any) to texttops. It'is simple, if there is a filename option given to texttops, but what should I do when the file comes from stdin? Here is my script so far:

if [ -z $CHARSET ];then

CHARSET=`expr "$LANG" : '.*\.\(.*\)'`

CHARSET=${CHARSET} texttops $1 $2 $3 $4 $5 $6 &

return 0

Normally the 6-th argument is filename, but when it is not given, texttops reads from stdin. So how can I redirect it to him:

$STDIN | CHARSET=${CHARSET} texttops $1 $2 $3 $4 $5 $6 &

Ok, I've modified it like this, now It seems to work:

if [ ! -t 0 ];then
STDIN="read 0< | "

if [ -z $CHARSET ];then

CHARSET=`expr "$LANG" : '.*\.\(.*\)'`

$STDIN CHARSET=${CHARSET} texttops $1 $2 $3 $4 $5 $FILE &

return 0

Last edited by kofucii; 12-01-2009 at 01:15 PM.
Old 11-12-2010, 10:37 AM   #2
Senior Member
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 233Reputation: 233Reputation: 233
Thumbs up

Thanks for posting the solution. That's the LQ spirit.

A suggestion for the future: If you answer your own question, put the solution in a separate post; this does 2 good things:
  • It generates e-mail to anyone who subscribed to either the thread or the forum.
  • It avoids the creation of oxymoronic 0-reply solved threads.


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
Problem with installing CUPS wrapper driver for Brother MFC-6800 Dymitry Linux - Hardware 1 08-10-2013 06:46 AM
What is OS wrapper bskumar7080 Linux - Software 1 11-14-2009 10:34 PM
NDIS Wrapper Help Please FuGeE Linux - Wireless Networking 1 12-11-2004 11:14 AM
OS Wrapper ines Linux - Software 10 11-04-2004 06:57 AM
ndis wrapper citrus Linux - Hardware 3 01-08-2004 06:10 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:22 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration