I'm getting different behaviour when executing below script in debug option.
$ cat ss.ksh
ff=$(pwd)
echo " ff : $ff"
$ ksh ss.ksh
ff : /tmp
$ ksh -x ss.ksh
+ + pwd
ff=
+ echo ff :
ff :
I was getting this behaviour in my actuall script i'm able to reproduce this in simple script also.
This behaviour is also different for having
#!/bin/ksh
and
#!/bin/ksh -x
in the first line of ss.sh script.
btw, I'm working in Solaris 10.
thz in advance.
I cannot reproduce it:
$ cat ss.ksh
ff=$(pwd)
echo " ff : $ff"
$ ksh -x ss.ksh
+ + pwd
ff=/tmp
+ echo ff : /tmp
ff : /tmp
$ ksh ss.ksh
ff : /tmp
$ uname -sr
SunOS 5.10
Neither do I:
$ uname -a
SunOS s10u9 5.10 Generic_142910-17 i86pc i386 i86pc
$ cat /etc/release
Oracle Solaris 10 9/10 s10x_u9wos_14a X86
Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
Assembled 11 August 2010
$ what /bin/ksh
/bin/ksh:
Version M-11/16/88i
SunOS 5.10 Generic 141589-04 May 2010
$ cat ss.ksh
ff=$(pwd)
echo " ff : $ff"
$ ksh ./ss.ksh
ff : /tmp
$ ksh -x ./ss.ksh
+ + pwd
ff=/tmp
+ echo ff : /tmp
ff : /tmp
The OP could try to trace the execution to check if the additional information could help.
If truss is available:
truss ksh -x ss.ksh
i'm sorry for wasting every'1 time. the problem is /tmp was not having enough it was having only 600 bytes free. After increasing /tmp free space everything is working.