${1#*=}的路径?

0 linux shell ubuntu

pluginPath="${1#*=}linux 中的路径代表什么意思?

顺便说一句,它来自 openfoam 的 parafoam 目录\\wsl.localhost\Ubuntu\usr\lib\openfoam\openfoam2306\bin

试图将其更改为 paraview 的其他路径

tel*_*coM 5

在 POSIX 风格的 shell 脚本中,${1#*=}意味着“为此脚本或 shell 函数指定的第一个位置参数字符串,省略从字符串开头到最左边字符的所有内容=”。

所以, ifparafoam是一个这样开头的脚本:

#!/bin/sh
pluginPath="${1#*=}"
Run Code Online (Sandbox Code Playgroud)

那么如果像这样调用它parafoam foo=/some/path bar baz,那么pluginPath变量赋值将相当于

pluginPath="/some/path"
Run Code Online (Sandbox Code Playgroud)

换句话说,这样的赋值意味着 的值pluginPath预计由调用该脚本或 shell 函数的任何内容指定。