LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   A question about shell scripts. (https://www.linuxquestions.org/questions/programming-9/a-question-about-shell-scripts-825193/)

stf92 08-09-2010 08:17 PM

A question about shell scripts.
 
Hi:

Code:

CODECSDIR=${CODECSDIR:-/usr/lib/codecs}
Could somebody tell me what the value of CODECSDIR will be after the line is executed/interpreted? This is the first time in the script where the variable CODECSDIR appears. Thanks in advance.

EDIT: also, when I am in the prompt, echo $CODECSDIR outputs nothing.

jlinkels 08-09-2010 08:42 PM

Because $CODECSDIR didn't exist yet it has been assigned a deafult value.

http://tldp.org/LDP/abs/html/refcards.html#AEN22008

Code:

jlinkels@jlinkels-lt:/tmp$ CODECSDIR=${CODECSDIR:-/usr/lib/codecs}
jlinkels@jlinkels-lt:/tmp$ echo $CODECSDIR
/usr/lib/codecs

jlinkels

stf92 08-09-2010 09:01 PM

Thank you. Your post has been very useful. Regards.


All times are GMT -5. The time now is 10:28 PM.