日本語のみで絞り込む
2010/2/10 -The following script reads from a file named "testonthis" line by line and then compares each line with a simple string, a string with special ...
2014/7/17 --eq is an arithmetic operator, which compares two numbers. Use = (portable/standard sh ), =~ or == instead.
2026/10/21 -Comparing strings is one of the most fundamental operations in Bash scripting. Use == and != for equality checks, =~ for regex matching, and -z ...
2023/3/13 -You can write an 'if' statement on a single line if you add ; : if [[ "str1" == "str2" ]]; then compare=true; else compare=false; fi.
2020/12/3 -Always wrap your variables with quotes, because if it is empty, your Bash script would encounter a syntax error. (Not because it would try to ...
2026/1/13 -Summary · Multiple Methods: You can compare strings using the test command, single brackets [ ] , double brackets [[ ]] , or one-liner logic.
2025/8/3 -The script below removes any . characters and adds 0 characters to the strings before comparing. Some examples are given in the table below.
2015/7/14 -The first echo says "OK" but if I want to compare the string its not "OK" anymore. Can anyone help me (I'm a linux newbie). command-line · bash ...
integer comparison. -eq. is equal to. if [ "$a" -eq "$b" ]. -ne. is not equal to. if [ "$a" -ne "$b" ]. -gt. is greater than. if [ "$a" -gt "$b" ].
2020/2/15 -Compare strings in Bash with =, ==, !=, -z and -n. Learn empty vs unset values, substring and glob matching, case-insensitive checks, ...