shell脚本中求余的指令
时间: 2023-10-13 09:03:36 浏览: 97
shell read指令
4星 · 用户满意度95%
在shell脚本中,求余的指令是%。这个指令用于计算两个数相除后的余数。例如,如果要计算10除以3的余数,可以使用以下代码:
```
result=$((10 % 3))
echo $result
```
结果将是1,因为10除以3的余数是1。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [Shell脚本echo指令使用小技巧](https://download.csdn.net/download/weixin_38584148/14892912)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [Shell脚本中awk指令的用法](https://download.csdn.net/download/weixin_38667581/12842304)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [shell脚本中一些特殊符号](https://download.csdn.net/download/weixin_38709466/14092113)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文