Results 1 to 2 of 2
Hi,
I just am make friend with scripting 2 weeks ago and has completely no idea how to search for the keyword to all the following syntax. Please help.
var1="${mode:-AUTO}"
...
- 12-23-2009 #1Just Joined!
- Join Date
- Feb 2008
- Posts
- 2
Beginner asking for explanation of escape character
Hi,
I just am make friend with scripting 2 weeks ago and has completely no idea how to search for the keyword to all the following syntax. Please help.
var1="${mode:-AUTO}"
Does this mean that the variable var1 is assigned with the pass-in argument? Then what does ':-AUTO' means?
var2="${mydate}_lock.text"
var3="$DTA/mypath/.runLock"
Asuming that mydate is 20091223, I understand that var2=20091223_lock.text, but how about var3? Why is no "{" after the "$". Also, I don't seem to find a directory of DTA/mypath. Is $DTA a keyword?
awk -vediauto="$EDIAUTO" -vedimanual="$EDIMANUAL" \
-vuser="$USER" --source '
I can't find the declaration of vediauto, vedimanual or vuser. I also don't find them as keyword of awk on any website. So, may I know what are the meaning of the 3 words: vediauto, vedimanual or vuser. Also, I only find a apostsophy " ' " in the statement.
All the above works in the program miraclely... Can you please help to advise the meaning behind them. And I would appreciate if you can advise me how to search for help of the above code in the web. I am not sure what is the keyword I should look for when googling.
Thanks in advance.
Regards
Te
- 12-23-2009 #2
It's a default value to use if the variable is not set.
Braces around variable names are optional. You only need them if there are following characters that could be misinterpreted as part of the name.var2="${mydate}_lock.text"
var3="$DTA/mypath/.runLock"
Asuming that mydate is 20091223, I understand that var2=20091223_lock.text, but how about var3? Why is no "{" after the "$". Also, I don't seem to find a directory of DTA/mypath. Is $DTA a keyword?
DTA is the name of a variable, probably an environmental variable since it's in upper case.
The initial -v simply means that the following string is a variable that is being assigned an initial value. So these variables are "ediauto", "edimanual" and "user". Again the values assigned to them are environmental variables.awk -vediauto="$EDIAUTO" -vedimanual="$EDIMANUAL" \
-vuser="$USER" --source '
I can't find the declaration of vediauto, vedimanual or vuser. I also don't find them as keyword of awk on any website. So, may I know what are the meaning of the 3 words: vediauto, vedimanual or vuser. Also, I only find a apostsophy " ' " in the statement.
Googling isn't the best way to answer this sort of problem. You should study the man page (or better still the info page) for bash. Or find a scripting HOWTO.All the above works in the program miraclely... Can you please help to advise the meaning behind them. And I would appreciate if you can advise me how to search for help of the above code in the web. I am not sure what is the keyword I should look for when googling."I'm just a little old lady; don't try to dazzle me with jargon!"


Reply With Quote
