bash - Bash 使用“?” 作为调用帮助函数的参数
问题描述
我正在尝试使用“-help”或“?” 作为调用我的帮助函数的参数。我的代码如下所示:
#Variablen deklarieren
declare +a source_dir="$1"
declare +a target_dir="$2"
#Aufruf help-function
if [ "$1" = "?" ] || [ "$1" = "-help" ] ; then
help_function
exit 0
fi
使用 -help 调用我的脚本会返回帮助功能,但我在使用“?”时遇到问题 作为参数。
解决方案
推荐阅读
- flutter - Flutter 多语言应用
- python - 如何重新激活 django 服务器?
- r - 为什么这个带有 lambda 函数的管道不返回一个矩阵?
- javascript - 如何在不添加内联样式的情况下从 div 中删除特定的 css?
- pyspark - spark如何应用“仅正确”加入?
- r - 如何将导入的图像与其他 R 图结合起来?
- systemd - 如何在计算机进入之前让 systemd 自动设置 /sys/power/image_size(为 0)
- azure-active-directory - 如何强制用户使用 MSAL 角度的两因素身份验证?
- reactjs - React-Player 无法正确调整视频大小
- python - 在 python 中使用自定义替换创建 Vigenere 样式加密