首页 > 解决方案 > `-f` 标志在 shebang 中使用时是什么意思:`#!/bin/bash -f`?

问题描述

shebang -f 标志是什么意思?具体来说,它用于 bash 脚本文件,

#!/bin/bash -f
echo hello
# blabla 

标签: linuxbashshell

解决方案


它将-f标志传递给bash运行脚本的实例:

来自$ bash -c "help set"

 -f  Disable file name generation (globbing).

来自https://tldp.org/LDP/abs/html/options.html

Abbreviation    Name    Effect

-f              noglob  Filename expansion (globbing) disabled

推荐阅读