tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: sh(1) vs. ksh(1)



In article <l03102800c5268e5a7b2b%q840.causeuse.org@localhost>,
Hauke Fath  <hauke%Espresso.Rhein-Neckar.DE@localhost> wrote:
>At 19:24 Uhr +0200 23.10.2008, Alan Barrett wrote:
>>What are the permissions of that file?  I checked the web page you
>>mentioned, and found that the file was a symlink, but I didn't notice
>>any ls(1) output showing the permissions of the target file.
>
>The sxemacs tarball is available at
><http://downloads.sxemacs.org/releases/sxemacs-22.1.9.tar.gz>.
>
>[hf@Gstoder] /<2>sxemacs/sxemacs-22.1.9 > ls -l config*.{sub,guess}
>-rwxr-xr-x  1 hf  wheel  23910 Jun  6 04:30 config.guess
>-rwxr-xr-x  1 hf  wheel   4072 Jun  6 04:30 config.sub
>-rwxr-xr-x  1 hf  wheel  44595 Jan 17  2008 configfsf.guess
>-rwxr-xr-x  1 hf  wheel  32726 Jan 17  2008 configfsf.sub
>-rwxr-xr-x  1 hf  wheel  23910 Jun  6 04:27 configgmp.guess
>-rwxr-xr-x  1 hf  wheel   4072 Jun  6 04:27 configgmp.sub
>[hf@Gstoder] /<2>sxemacs/sxemacs-22.1.9 >
>
>-- the config.{sub,guess} files are copies of the configgmp.{sub,guess}
>files. Problems are the same with symlinks as with actual copies.
>
>From the latest feedback by the sxemacs guys, it looks like it's a quoting
>issue, possibly different behaviour between calling /bin/echo and the ksh
>built-in echo?
>
>Apparently, with ksh(1), the expression
>
>configfsf_sub="`echo \"$0\" | sed 's/config.sub$/configfsf.sub/'`"
>
>ends up with the filename double-quoted in configfsf_sub.

The quoting semantics of `` and $() are different. You should never use
`` because they also don't nest. 

You should always $(). Try:

$ echo "`echo foo \" \" bar`"
foo   bar
$ echo "$(echo foo \" \" bar)"
foo " " bar

christos



Home | Main Index | Thread Index | Old Index