Re: any shell that doesn't expand \t or \n in it's arguments?

From: jwk (_hate_spam_thunder7_at_xs4all.nl)
Date: 03/30/04


Date: 30 Mar 2004 17:43:58 GMT

From: Barry Margolin <barmar@alum.mit.edu>
Date: Tue, 30 Mar 2004 09:31:17 -0500
> In article <slrnc6imuc.7in._hate_spam_thunder7@middle.of.nowhere>,
> jwk <_hate_spam_thunder7@xs4all.nl> wrote:
>
>> I have a program that calls a script to print files, both on windows and
>> on unix systems.
>>
>> Because of the windows systems, one argument to the script is like this:
>>
>> \\host\queue
>>
>> Depending on the name of queue, this makes the script on unix go
>> haywire:
>>
>> \x is '\' 'x', but \t becomes '<tab>'
>>
>> is there any way to start a shell which prevents this horrible mess?
>> The only alternative is to rename all my print-queues :-(
>
> AFAIK, none of the common shells automatically translate \t and \n. If
> any translation is done, it's by individual commands, e.g. "echo". They
> generally provide a way to suppress it, or you must escape the
> backslashes (e.g. change \t to \\t before passing the string to the
> command).
>
> If you show the script, perhaps we can provide more detailed guidance.
>
Aha - it's echo then. The faulty part is something like this:

host=`echo $1 | cut -d"\\" -f1`
queue=`echo $1 | cut -d"\\" -f2`

Time to go play with bash and ${param:offset:length}.

Thanks,
Jurriaan

-- 
I've seen people with new children before, they go from ultra happy to
looking like something out of a zombie film in about a week.
	Alan Cox about Linus after his 2nd daughter
Debian (Unstable) GNU/Linux 2.6.5-rc2-mm5 2x5947 bogomips 0.15 0.23


Relevant Pages

  • Re: What is this error?
    ... > This script shows the error... ... alias on UNIX systems, and the "-l" option gives the long-format listing ... Cocoa programming in Perl: http://camelbones.sourceforge.net ...
    (comp.lang.perl.misc)
  • Re: any shell that doesnt expand or in its arguments?
    ... > on unix systems. ... > Because of the windows systems, one argument to the script is like this: ... none of the common shells automatically translate \t and \n. ... any translation is done, it's by individual commands, e.g. "echo". ...
    (comp.unix.shell)
  • any shell that doesnt expand or in its arguments?
    ... on unix systems. ... Because of the windows systems, one argument to the script is like this: ... The USENET Oracle ...
    (comp.unix.shell)
  • Re: Optimize flag on shebang line
    ... > Does the optimize flag work on the shebang line of UNIX systems? ... > tried to execute a script on a Solaris system with a shebang line of the ...
    (comp.lang.python)
  • RE: dealing with lengthy (time) query sets
    ... I would put the 'x' records into a QUEUE table. ... My last resort which i know works is to make another script that makes ... its own database connection does its work and dies. ... sender of the delivery error by replying to this message, or notify us by ...
    (perl.dbi.users)