快速回答if / else语句在shell中的问题,现在我正试图测试两个不同的值是否等于第三个
#ff .ffstyle {
box-sizing: border-box;
font-family: 'Open Sans', Helvetica, Arial, sans-serif;
}
#ff html, body {
height: 100%;
margin: 0;
}
#ff table {
width: 100%;
height: 100%;
border-collapse: collapse;
}
#ff thead th,
#ff tbody td:first-child:not([colspan="6"]) {
background: #456;
color: white;
}
#ff tbody tr td:first-child {
text-align: left;
}
#ff tbody td:not(:first-child) {
background: #EEF;
}
#ff tbody td:not(:first-child):hover {
background: #E8E8FF;
}
#ff td[colspan="6"] {
height: 5px;
padding: 0;
}
<!--this tag below, still affecting my nav menu even though its id is
#ff-->
#ff th, td {
width: 18.5%;
padding: 1%;
border: 1px solid #CCC;
text-align: center;
}
#ff th:first-child,
td:first-child {
width: 7.5%;
}
正如您从上面的代码中看到的,我正在尝试测试prevdate和currdate是否匹配Todaysdate但我似乎可以让它工作任何帮助都会很棒
答案 0 :(得分:2)
您必须使用两个条件:
if [ "$TodaysDate" = "$prevDate" ] && [ "$TodaysDate" = "$currDate" ] ; then
或-a
运营商(不推荐)
if [ "$TodaysDate" = "$prevDate" -a "$TodaysDate" = "$currDate" ] ; then
或者,如果您正在使用bash,请切换到[[ ... ]]
条件:
if [[ $TodaysDate = $prevDate && $TodaysDate = $currDate ]] ; then
答案 1 :(得分:1)
if test "$TodaysDate" = "$prevDate" && test "$TodaysDate" = "$currDate"; then ...