The other thing worth mentioning is that with

> [root@lonmay /root]# msword_vd $SAFENAME
> msword_vd: No such file or directory
> [root@lonmay /root]# msword_vd "$SAFENAME"
> word_vd: No such file or directory

only the second version will work, as the shell will expand ``$SAFENAME'',
seperating the words, which isn't what you want; for example:

> [paul@zebedee paul]$ touch "nothing here"
> [paul@zebedee paul]$ name="nothing here"
> [paul@zebedee paul]$ echo $name
> nothing here
> [paul@zebedee paul]$ ls $name
> ls: nothing: No such file or directory
> ls: here: No such file or directory
> [paul@zebedee paul]$ ls "$name"
> nothing here
> [paul@zebedee paul]$

The problem can be that echo doesn't distinguish between a space that's
part of a "word" and a space that's an inter-word gap: the output from the
commands ``echo ls $name'' and ``echo ls "$name"'' look identical, but the
arguments are different!

HTH

Paul.

On Thu, 19 Jul 2001, Gavin McCord wrote:
> On 2001.07.18 18:40:21 +0100 Lawrence Sweeney wrote:
> > On 2001.07.18 17:14 Colin McKinnon wrote:
> > > At 16:09 18/07/01 +0100, Colin McKinnon wrote:
> > > >I'll go and have a wee play around now.
> > > 
> > > Am I doing something stoopid again?:
> > > 
> > > [root@lonmay /root]# ls -l *.doc
> > > -rw-r--r--   1 root     root       123392 Jul 18 17:02 TEST FILE.doc
> > > [root@lonmay /root]# msword_vd TEST\ FILE.doc
> > > [root@lonmay /root]# # - that is whats supposed to happen
> > > [root@lonmay /root]# SAFENAME="TEST\ FILE.doc"
> > > [root@lonmay /root]# echo $SAFENAME
> > > TEST\ FILE.doc
> > > [root@lonmay /root]# msword_vd $SAFENAME
> > > msword_vd: No such file or directory
> > > [root@lonmay /root]# msword_vd "$SAFENAME"
> > > word_vd: No such file or directory
> > 
> > You're overegging the pudding here
> >  
> > either
> > SAFENAME="TEST FILE.doc"
> > or
> > SAFENAME=TEST\ FILE.doc
> > would do
> > 
> > 
> > both of these, in ascii, roughly equate to
> > TEST SPACE FILE
> > yours equates to
> > TEST BACKSLASH SPACE FILE
> > 
> > use one methor OR other, not both. :-)
> > 
> 
> Using
> 
>   ls 
> 
> will then list it as
> 
> TEST FILE.doc
> 
>   ls -b
> 
> lists
> 
> TEST\ FILE.doc
> 
> --
> Gavin McCord

------------------------------------------------------------------------------
Paul Millar                            yo-yo, n. :
Particle Physics Theory Group              Something that is occasionally
Department of Physics and Astronomy        up but normally down.
University of Glasgow,                     (see also Computer)
Glasgow G12 8QQ,                                       [EMAIL PROTECTED]
Scotland                                               +44 (0)141 330 4717
------------------------------------------------------------------------------


--------------------------------------------------------------------
http://www.lug.org.uk                   http://www.linuxportal.co.uk
http://www.linuxjob.co.uk               http://www.linuxshop.co.uk
--------------------------------------------------------------------

Reply via email to