Quote:
Originally Posted by P.G.Krish
${1#*@}
i saw this from shell script, I want to understand what It means? I searched google , They returns nothing. Do u have any idea
|
The ${ term } portion means "term" used as a command, for example:
Code:
~ abc=ls
~ ${abc}
. .. 1.txt 2.txt
The ${abc} cause a substitution of the symbol abc with what that symbol is assigned too.
1#*@ appears to be some form of weird regular expression, or it is a variable symbol which has already been set up within this script.
The couple of things you can do are to:
- Post more of this script leading up to this point and especially all references to this symbol or variable
- Insert a "set -xv" into the script and run it and observe what happens.
- Insert some "echo ${1#*@}" lines into the script to cause an echo of what this variable or symbol represents.
If this turns out to be a very poorly named variable, then it is a very bad script.
In regular expressions asterisk * means "1 or more times", unsure what @ means, if anything. Someone more well versed in regex may know more. To me this statement is nonsense and if it is really the script authors "cute" variable name, it is a bad variable name. My point there being that while people can write "legally correct syntax", it does not mean they should try to write obtuse code that other people cannot properly interpret.