I have created a script file .sh and had some allias commands, local variable, some grep features, and listing files/directories, and it worked correctly and I got the outputs I am looking for after I run the script . However, some of the grep commands and some other functions did not worked after I tried to run the script in another script to get the output of the original script printed in another scrip so I can print out the output. Does anyone know what is the problem with that ?
e.g. my is script kk.sh and it runs and prints the output after I run it the permission is 700
.
.
Then I did:
script output.out <enter>
kk.sh
exit
.
.
some of the outputs didn't worked in output.out.. why? and how I can fix it ?
Does your kk.ksh have a shebang line at the beginning, e.g. #!/usr/bin/ksh? The reason I ask is because when you run script, by default it launches a standard sh shell, so unless you have a shebang line in your script it may be running under sh insted of the usual ksh, and could explain why some of your code no longer works.