我一直在努力解决这个问题几个小时,并尝试了我在讨论区找到的一切。我无法切换到bin/sh
,这应该是while [ $currentID -gt 0 ]
。
问题在于while循环" 21: [: 2893: unexpected operator
。错误为#!/bin/sh
Menu_Option=0
echo "WELCOME"
echo "--------------------------------------------------------------"
while [ $Menu_Option -ne 4 ]
do
echo "select a menu option"
echo "1- ancestry history"
echo "2- who is online"
echo "3- what process any user is running"
echo "4- exit"
read Menu_Option
case $Menu_Option in
1)
echo "THE ANCESTRY TREE FOR CURRENT PROCESS IS...."
echo " "
ps -ef > file1
currentID=$(awk '{if ($3 == '$PPID') print $2}' file1)
while [ $currentID -gt 0 ]
do
Process_Name=$(awk '{if ($2 == $currentID) print $8 " " $9}' file1)
<script id="ddlTemplate" type="text/html">
@Html.Partial("_DropDown", (SelectList)(Model.DeviceTypes))
</script>
答案 0 :(得分:0)
我希望您需要以下内容:
#!/bin/sh
Menu_Option=0
echo "WELCOME"
echo "--------------------------------------------------------------"
while [ $Menu_Option -ne 4 ]
do
echo "select a menu option"
echo "1- ancestry history"
echo "2- who is online"
echo "3- what process any user is running"
echo "4- exit"
read -r Menu_Option
case $Menu_Option in
1)
echo "THE ANCESTRY TREE FOR CURRENT PROCESS IS...."
echo " "
ps -ef > file1
currentID=$(awk '{if ($3 == '$PPID') print $2}' file1)
while [ "$currentID" -gt 0 ]
do
Process_Name=$(awk '{if ($2 == '"$currentID"') print $8 " " $9}' file1)
echo "$Process_Name"
currentID=$(awk '{if ($3 == '"$currentID"') print $2}' file1)
if [ "$currentID" = "" ]
then
currentID=-1;
fi
done
echo ""
esac
done