我的软件有一个安装脚本,我需要它在Linux和AIX上都可以运行。
On Linux I can use a wrapper myinstaller.ksh
like this one:
#!/usr/bin/ksh
script -c myrealinstaller.ksh /var/log/myinstaller.log
But on AIX script
does not support the -c
option.
How can I run my myrealinstaller.ksh
inside the forked shell created by script?
You could enhance your wrapper script to detect the OS; if it's running on Linux, execute
script -c ...
, but if it's running on AIX, give the script-shell an overridden profile that only runs your installer, then exits:我调整了脚本的路径并记录以在本地对其进行测试。涉及的其他因素是:
ENV
to point to the overridden profile as we callscript
script
with-q
to quiet it down a bit使用以下示例myrealinstaller.ksh:
./var/log/myinstaller.log的内容为: