Echo $? always return 0

Echo $? always return 0

Post by Onnei Che » Fri, 23 Apr 1993 06:24:51



Hi,guys

Can someone explain to me why the following is
1) create a file as follow:
        exit 34
2) execute this script file in /bin/sh shell    
3) see what : echo $? : returns back
4) I received 0, is this a bug? is it fixed?

onnei

 
 
 

Echo $? always return 0

Post by Vladimir Vukicev » Wed, 28 Apr 1993 11:48:23



>Hi,guys

>Can someone explain to me why the following is
>1) create a file as follow:
>    exit 34
>2) execute this script file in /bin/sh shell        
>3) see what : echo $? : returns back
>4) I received 0, is this a bug? is it fixed?

>onnei

What shell are you using? tcsh does not return this. It returns the correct
code.

        - Vladimir

--
#----           Vladimir Vukicevic             #include <std_disclaimer.h>

#--------

 
 
 

1. Does "echo prompt: | tr -d '\012'" always work?

Trying to write shell scripts that are very portable, but that need to
prompt for input, can be a pain.  In particular you usually have to do
one of the following:
        echo -n "Enter host type:"
        echo "Enter host type:\c"

Does anyone know of a system where the following DOES NOT work?
        echo "Enter host type:" | tr -d '\012'

PLEASE DO NOT TELL ME IF IT WORKS.  I only want to know of places
where it doesn't.

Responses to me will be summarized.

Thanks.
        /r$
--

Use a domain-based address or give alternate paths, or you may lose out.

2. libgd.so.1

3. Prompt not returning from script when echo precedes wait.

4. AST 950N 11.8 Active XFree support?

5. echo $USER does not return me anything on Solaris machine

6. gui diff tool for linux?

7. Reading from stdin without RETURN and echo

8. repost: Turbo LInux???

9. echo with CARRIAGE RETURN

10. Bourne shell question --> echoing return value?

11. echo and carriage returns? <sec>

12. echo $USER does not return my username

13. (?) CGI script not always returning data