On Tue, 2006-09-26 at 19:27 +0200, HIToC wrote:
> Hello Henry,
>
> I have used "sh": sh script
> But using ./script has the same problem: DATEMSK is not
exported.
>
> Thank you for the emails
> HIToC
>
If you execute a script via sh script.sh or ./script.sh it
is executed
in a sub shell. So every exported variable is only set in
all sub-sub
shells.
Try this script to see what I mean
#!/bin/sh
export V=Test
echo $V
Now execute it in a sub shell:
sh script.sh
echo $V
and execute it in the current shell (via sourcing it)
. ./script.sh
echo $V
or
source script.sh
echo $V
Best regards,
Henry
-
To unsubscribe from this list: send the line
"unsubscribe linux-c-programming" in
the body of a message to majordomo vger.kernel.org
More majordomo info at http://vge
r.kernel.org/majordomo-info.html
|