what does the $ as a variable do?

Michael Havens bmike1 at gmail.com
Mon Jan 19 09:20:52 MST 2015


thanks guys!

:-)~MIKE~(-:

On Mon, Jan 19, 2015 at 5:09 AM, coverturtle <coverturtle at gmail.com> wrote:

>  On 01/18/2015 07:49 PM, Michael Havens wrote:
>
> people are reporting a bug in steam. apparently there is a line in it that
> is deleting all the personal data all connected read/write media.
>  this is how the line reads:
>
>
>  rm -rf $STEAMROOT/*
>
>
>  what does the '$' expand too?
>  :-)~MIKE~(-:
>
>
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss at lists.phxlinux.org
> To subscribe, unsubscribe, or to change your mail settings:http://lists.phxlinux.org/mailman/listinfo/plug-discuss
>
>  DON'T EXECUTE THE ABOVE LINE!
> I'm assuming you have a terminal to verify this:
> If the variable "STEAMROOT" is empty, it expands to the null string, i.e.
> empty string.
> i.e. /*  which is very bad if preceded by rm -rf because "r" is recursive
> and "f" means
> to force the execution of the remove and it will remove all your files.
> If it is <someString> then it expands to   <someString>/*
> it is supposed to expand to the path for the home directory for the steam
> data
> but if empty, wipes out any part of file system in which the bash script
> is
> executing and for which bash has permissions.
> $STEAMROOT should be set to some harmless default value like /tmp
> If the bash line is set to
> rm -rf ${STEAMROOT:-/tmp}/*
> then there shouldn't be any unwanted damage.  Check out
> man rm
> and
> man bash
> for more than you wanted to know.  Search ("/") for "${" in man bash for
> details.
> Jon
>
>
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss at lists.phxlinux.org
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.phxlinux.org/pipermail/plug-discuss/attachments/20150119/4cbe98fb/attachment.html>


More information about the PLUG-discuss mailing list