我有一个 bash 脚本,我想检查一个字符串是否在列表中。比如:string = "Hello World!", List=("foo", "bar")。蟒蛇示例:
if name in list: # Another way -> if name in ["foo", "bar"] # work to do else: sys.exit(1)
谢谢!
linux bash shell
bash ×1
linux ×1
shell ×1