I don't understand the '\'

I don't understand the '\'

Post by Jim Kon » Tue, 05 May 1998 04:00:00



How would I get the following line to be cat'ed out to a file using 2
variables

var1=something1
var2=something2

c:\unix\somthing1\something2

I guess my question is how to get the '\' to print correctly before a
variable ?

Thanks

Jim

 
 
 

I don't understand the '\'

Post by Charles Dem » Tue, 05 May 1998 04:00:00




>How would I get the following line to be cat'ed out to a file using 2
>variables

>var1=something1
>var2=something2

>c:\unix\somthing1\something2

>I guess my question is how to get the '\' to print correctly before a
>variable ?

Since a backslash generally escapes the next character, use two in
succession:

Here's a simple script:

#!/usr/bin/sh
#
var1=something1
var2=something2
echo "c:\\dir1\\${var1}\\${var2}"

Which produced this output:

c:\dir1\something1\something2

You can redirect this script to a file or just redirect the echo
inside the script.

In this script the curly braces aren't needed, but in other scripts
they might be needed to isolate the variable names from other
characters.

Read the manual page for your shell, RTFM  :-)

man sh
man csh
man tcsh
 .
 .
 .
as appropriate.

Chuck Demas
Needham, Mass.

--
  Eat Healthy    |   _ _   | Nothing would be done at all,

  Die Anyway     |    v    | That no one could find fault with it.


 
 
 

I don't understand the '\'

Post by brian hil » Wed, 06 May 1998 04:00:00


: How would I get the following line to be cat'ed out to a file using 2
: variables
: c:\unix\somthing1\something2

Use ksh, not sh. (You neglect to describe which shell you are using.)

Use the -r option to print; the above is what this option exists for.
Consult the man pages for more information.

-Brian

 
 
 

1. 'make' fails, and I don't understand the error msg

I'm trying to install zsh on a Solaris box at work. I'm a newbie with
Unix installation, so I'm just going to install it in my home
directory, rather than risk messing up the machine for others. I've
done so with a couple of other Unix apps, and it has worked find.

I downloaded it, unpacked it, cd'ed into the directory that resulted
from the unpacking, and ran ./configure as follows:

./configure --disable-etcdir --prefix=/home/tuang/bin/zsh/here

That worked fine, as it has with other apps that I've installed in my
home dir.

Then, I typed "make" as usual, but I got an odd error message this
time that comes back to me almost immediately:

$ make
/bin/sh: Src: does not exist
make: *** [all] Error 1

I'm so new at this, that I don't know what that error message is
saying. I'm guessing that make runs a shell script that uses the
/bin/sh shell. (I typed /bin/sh and verified that this shell exists.)
I think the /bin/sh shell is telling me that "Src" doesn't exist. I
don't know whether that's a directory or a file or something else, but
the Src *directory* certainly does exist. In the same directory where
I typed ./configure and make, if I do an ls, this is what I get:

$ ls
ChangeLog        META-FAQ         aclocal.m4       configure*
ChangeLog-3.1    Makefile         aczsh.m4         configure.ac
ChangeLog.3.0    Makefile.in      config.cache     configure.in
Completion/      Misc/            config.guess*    install-sh*
Config/          README           config.h         mkinstalldirs*
Doc/             Src/             config.h.in      stamp-h
Etc/             StartupFiles/    config.log       stamp-h.in
Functions/       Test/            config.modules   zshconfig.ac
INSTALL          Util/            config.status*
LICENCE          acconfig.h       config.sub*

I read README and INSTALL. I looked in the files Makefile and
Makefile.in for the string "does not exist" to see if the error was
coming from those files and might include a comment, but that string
wasn't in either file. In "install-sh", I did find

echo "install:  $src does not exist"

but I don't think that's it. I think the resemblance to my error msg
is a coincidence (but of course I'm not sure).

Google searching hasn't gotten me anywhere this time either, so I'd be
grateful for any tips. What program is telling me this, and what does
it mean? What did I do wrong, and how can I do it right?

Thanks.

2. HELP!! Disk all screwed up!

3. I don't understand why this code isn't working

4. D-Link DGE-528T; Which driver? 2:nd try...

5. PPP to Win NT RAS, I don't understand what's going on... help !

6. apache II ?

7. Pls help: 'efax' and 'diald' don't quite get along

8. fvwm - windows to foreground.

9. 'batch' and 'at' don't work

10. 'make' and 'gcc' don't work

11. 'stty -opost' or 'stty -onlcr' don't work ?!

12. doesn't sendmail understand 'm' flag ?

13. Don't bother to post, was, Re: TEST:don't bother to read