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

From: Chris F.A. Johnson (c.fa.johnson_at_rogers.com)
Date: 03/30/04


Date: 30 Mar 2004 19:30:45 GMT

On Tue, 30 Mar 2004 at 17:43 GMT, jwk wrote:
> 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`

   There's no need for an external command:

oldIFS=$IFS

IFS='\'
set -- $1
host=$1
queue=$2

IFS=$oldIFS

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

-- 
    Chris F.A. Johnson                  http://cfaj.freeshell.org/shell
    ===================================================================
    My code (if any) in this post is copyright 2004, Chris F.A. Johnson
    and may be copied under the terms of the GNU General Public License


Relevant Pages

  • Re: how to write sysrexx
    ... I now have a sysrexx question.... ... How do suppress the '/DI,L=Z' output after you issue the command. ... I used to work a lot of Netview and rexx inside Netview and we had IBM ... We use question mark as the command character for secondary JES2 ...
    (bit.listserv.ibm-main)
  • Re: Executing secondary command in shell.run
    ... The second command with double double quotation marks definitely affects the first commands here. ... Which wrongly suppress the "AAA " part. ...
    (microsoft.public.scripting.vbscript)
  • Re: How to suppress Word dialogs during merge
    ... Word New User FAQ & Web Directory: http://addbalance.com/word ... > the command line and would like to suppress (or ... > Sub MyMerge() ...
    (microsoft.public.word.mailmerge.fields)
  • Re: sed command fails if line has quote
    ... I might have forgotten to escape certain ... You have a regexp: ... A systemcommand: ... But than you have a script that depends on external commands and so it ...
    (comp.lang.php)
  • Suppressing PER messages
    ... Is there a way to suppress the message 'Command Complete' issued by a PER CMD? ... Issue 'PER DIAG 58 PRINTER CMD DUMP 0.20;BASE3' ...
    (bit.listserv.ibm-main)