有没有办法从rpm包中提取spec文件(我只有RPM文件)
不是
rpm --scripts -qp my-great-app-1.1.2.rpm
Run Code Online (Sandbox Code Playgroud)
(这种语法只能从rpm获取spec脚本中的脚本)
我如何从VBScript执行DOS命令(而不是.bat文件)
例如,我想从VBScript执行以下操作:
cd /d C:dir_test\file_test
sanity_check_env.bat arg1
Run Code Online (Sandbox Code Playgroud) 我的目标是调试(逐步)sample.pl下面的脚本.
问题:我没有得到变量的实际值($ top_number,$ x,$ total).
我的问题:如何从跟踪输出中查看($ top_number,$ x,$ total)的实数整数值?
perl -d:Trace为了得到数字需要改变什么,而不是:$ top_number,$ x,$ total?
跟踪输出示例:
[root@linux /tmp]# perl -d:Trace ./sample.pl
>> ./sampl.pl:9: $top_number = 100;
>> ./sampl.pl:10: $x = 1;
>> ./sampl.pl:11: $total = 0;
>> ./sampl.pl:12: while ( $x <= $top_number ) {
>> ./sampl.pl:13: $total = $total + $x; # short form: $total += $x;
>> ./sampl.pl:14: $x += 1; # do you follow this short form?
>> ./sampl.pl:13: $total = $total + $x; # …Run Code Online (Sandbox Code Playgroud) 运行时,rpm -qlp我将获得RPM的文件内容,如下所示,但是运行时,我将rpm --scripts -qp CBS0.0.0_10.0.i386.rpm获取脚本的内容,而不是脚本的文件名。
我的问题是为什么我不能在RPM内容中看到脚本名称(即,脚本来自何处?)
$ rpm -qlp CS0.0.0_10.0.i386.rpm
/home/thy_diff/rt
/home/thy_diff/rt/Cerse-zip
/home/thy_diff/rt/Configure_rht.properties
/home/thy_diff/rt/UFE_Install.sh
/home/thy_diff/M_client
/home/thy_diff/M_client/Crse-CLIENT.zip
/home/thy_diff/M_client/Configure_client.properties
/home/thy_diff/M_client/UF_Install.sh
Run Code Online (Sandbox Code Playgroud) 以下script.bin通过tee行追加到file.log(来自我的bash脚本)
IP=xxx.xxx.xxx.xxx
./script.bin | tee -a file.log
Run Code Online (Sandbox Code Playgroud)
我的目标是在tee创建的每一行之后添加"IP = 127.0.0.1"(IP地址为示例)
注意:我们无法修改script.bin以添加"IP = 127.0.0.1" - 因为它的二进制文件
我需要建议如何在file.log中创建的每一行之后添加IP = xxx.xxx.xxx.xxx
乔恩
cat file.log (the ordinary file.log)
start_listen_to_port - 5500
start_listen_to_port - 5400
start_listen_to_port - 5410
.
.
.
cat file.log ( the right log.file syntax )
start_listen_to_port - 5500 IP=127.0.0.1
start_listen_to_port - 5400 IP=127.0.0.1
start_listen_to_port - 5410 IP=127.0.0.1
.
.
.
Run Code Online (Sandbox Code Playgroud) 请看看以下所有我想要的是从文件中获取node_name字符串并执行uniq以获取uniq字符串,如果它们相等
但是在下面的例子中我有两条相等的线(node_name moon1)
但为什么uniq命令不能将它减少到一行?,我真的不明白这个为什么?
sed s'/=/ /'g file| awk -v WORD=node_name '$2 == WORD {print $0}' | awk '{print $2" "$3}' | sort | uniq
node_name moon1
node_name moon1
Run Code Online (Sandbox Code Playgroud)
文件:
.
.
/home/home1/home2/config1/COMPANY/my.config node_name=moon1
/home/home1/home2/config1/MEAS2XML/my.config.tmp node_name=moon1
.
.
Run Code Online (Sandbox Code Playgroud) 我编写了以下简单的c ++程序,以了解如何从C++程序调用Linux命令(使用system命令)
请告诉我为什么我有C++编译器的错误?我的程序有什么问题?
#include <stdio.h>
#include <stdlib.h>
int main()
{
system("echo -n '1. Current Directory is '; pwd");
system("mkdir temp");
system();
system();
system("echo -n '3. Current Directory is '; pwd");
return 0;
}
[root@linux /tmp]# g++ -Wall exm2.cc -o exm2.end
/usr/include/stdlib.h: In function ?int main()?:
/usr/include/stdlib.h:738: error: too few arguments to function ?int system(con?
exm2.cc:7: error: at this point in file
/usr/include/stdlib.h:738: error: too few arguments to function ?int system(con?
exm2.cc:8: error: at this point in file
Run Code Online (Sandbox Code Playgroud)