「予期しないトークン `done 'の近くの構文エラー」というエラーが発生し、スクリプトを理解できません。私のコードは以下の通りです:
trap "rm ~/tmp/* 2> /dev/null; exit" 0 1 2 3
phonefile=~/sournce/corp_phones
looptest=y
while [ $looptest" = y ]
do
clear
cursor 1 4; echo "Corporate Phone List Additions"
cursor 2 4; echo "=============================="
cursor 4 4; echo "Phone Number: "
cursor 5 4; echo "Last Name : "
cursor 6 4; echo "First Name : "
cursor 7 4; echo "Middle Init : "
cursor 8 4; echo "Dept # : "
cursor 9 4; echo "Job Title : "
cursor 10 4; echo "Date Hired :"
cursor 12 4; echo "Add Another? (Y)es or (Q)uit "
cursor 4 18; read phonenum
if [ "$phonenum" = 'q' ]
then
clear; exit
fi
cursor 5 18; read lname
cursor 6 18; read fname
cursor 7 18; read midinit
cursor 8 18; read deptno
cursor 9 18; read jobtitle
cursor 10 18; read datehired
#check to see if last name is not a blank before write to disk
if [ "$lname" > " "]
then
echo $phonenum:$lname:$fname:$midinit:$deptno:$jobtitle:$datehired >> $phonefile
fi
cursor 12 33; read looptest
if [ "$looptest" = 'q' ]
then
clear; exit
fi
done
現在、3つの障壁があります。
$looptest"
ません-"$looptest"
>
文字列を比較するために使用する"$lname" > ...
必要がありますif [ "$lname" != ...
ここで少し時間を取って、shellcheck.netサービスを呼び出します。そこのボックスにコードを貼り付けると、提案や警告が表示されます。
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加