基于给定文件test.txt
的信息,我希望得到一个pid及其可执行路径,用于对该文件进行操作的进程。
例如,如果从命令行有人运行了这个:
$ cat test.txt
...然后我想要一些能够提供与此类似的输出的东西:
process 1123 bin/cat is using /home/sam/test.txt
答案 0 :(得分:1)
如果文件仍处于打开状态,您可以使用:
function CollegeDepartment() {
var s1 = document.getElementById("college");
var s2 = document.getElementById("department");
s2.innerHTML = "";
if (s1.value == "College of Engineering") {
var optionArray = ["Civil Engineering", "Computer Engineering", "Electrical Engineering", "Electronics and Communication Engineering", "Industrial Engineering", "Mechanical Engineering"];
} else if (s1.value == "CAS") {
var optionArray = ["Political Science", "Mascomm", "Liacomm"];
} else if (s1.value == "Commerce") {
var optionArray = ["Business Ad", "Hotel Management", "Tourism"];
} else if (s1.value == "Education") {
var optionArray = ["SPED"];
} else if (s1.value == "CICCT") {
var optionArray = ["Computer Science", "Information Technology"];
}
for (var option in optionArray) {
var newOption = document.createElement("option");
newOption.value = optionArray[option];
newOption.innerHTML = optionArray[option];
s2.options.add(newOption);
}
};