It is currently Tue, 30 Nov 2021 18:11:48 GMT



 
Author Message
 Strange behavior of /bin/sh..
Hello,

The plateform is FreeBSD-3.0 on a dual Pentium machine. The shell
(/bin/sh) exhibits strange behavior..

The following script echoes (origin: from a Solaris machine..)
ls
to stdout.

It seems to work correctly under bash.

Any pointers?
- ishwar rattan

----
#! /bin/sh

lspath=/bin/ls

cmd=`exec basename $lspath`

echo "after command substitution.."

exit 0



 Sat, 07 Apr 2001 03:00:00 GMT   
 Strange behavior of /bin/sh..
In comp.unix.bsd.freebsd.misc, ishwar rattan  <3CQB...@cmuvm.csv.cmich.edu> wrote:

Then bash is broken.  ;-)

The problem is that "exec" statement in your backquotes.  Take it out
and all will be well.  There's no need for it at all there.  Read the
manual page fr a couple of shells to figure out precisely what it does.

--
Dom Mitchell -- Palmer & Harvey McLane -- Unix Systems Administrator
"Xerox studies suggest that most people print out electronic mail
 that is longer than half a page; paper use rises by 40 percent in
 offices that introduce E-mail." -- CCM



 Sun, 08 Apr 2001 03:00:00 GMT   
 
   [ 2 post ] 

Similar Threads

1. #!/bin/sh #!/usr/bin/sh can I do both for 2 diff machines

2. Odd /bin/sh behavior on HP-UX 9.01

3. Very bizarre /bin/sh behavior

4. Strange behavior with shared /var/mail, /bin/mail and secure NFS

5. Strange /usr/bin/mail behavior

6. Strange behavior from /bin/cc

7. /bin/sh on Solaris 8 - strange result...

8. strange behaviour with setuid /bin/sh

9. strange traps in HP-UX /bin/sh

10. /bin/sh, /bin/ksh crash with SIGSEGV with a huge script


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software