PageList2
Search and Subscribe
แหล่งรวมความรู้ทางด้าน Unix (Sun Microsystems Inc),HP-UX,Linux รวมถึงการเขียน Shell Script
09:38
การเปรียบเทียบ ตัวแปร string ใน shell script unix และ linux
Posted by K-Tech · 1 Comments in this post
การเปรียบเทียบ ตัวแปร string ใน shell script
!= ไม่เท่ากับ
== เท่ากับ
if [ "$filename" != "" ];
then./exportDatafi;
หรือ
if [ $filename != "" ];
then./exportData
fi;
ให้ผลลัพธ์เหมือนกัน
การเปรียบเทียบเท่ากัน ==
if [ $filename == "" ];
then
./exportData
fi;
if then else
if[$filename == ""];
then
./exportData
else
./delData
fi;
อ้างอิง
http://www.devwinner.com/unix/unix-shell-script-compare-string-4.html
About this blogger theme
This blogspot theme one of the first templates I have created. This is free, supported and ready for download. If you have any questions feel free to leave your comment on my weblog. Hope you like it. Enjoy!
This blogspot theme one of the first templates I have created. This is free, supported and ready for download. If you have any questions feel free to leave your comment on my weblog. Hope you like it. Enjoy!
1 comment
การเปรียบเทียบ ตัวแปร string ใน shell script unix และ linux
การเปรียบเทียบ ตัวแปร string ใน shell script unix และ linux

!= ไม่เท่ากับ --> "-ne"
== เท่ากับ --> "-eq"
if [ "$filename" -ne "" ];
then
./exportDatafi;
fi