[Discuss] rsync v. cp in data migration
Jerry Feldman
gaf at blu.org
Sun May 26 07:36:14 EDT 2013
On 05/25/2013 11:42 AM, Derek Martin wrote:
> One last point:
>
> On Sat, May 25, 2013 at 09:32:02AM -0400, Greg Rundlett (freephile) wrote:
>> # we will use a prepared file 'users' whose contents are a list of users,
>> one user per line
>> while read USER
> The variable $USER is set for you by the system when you log in, and
> some things may depend on it (this is a very old Unix feature, and
> I've forgotten which--most things should no longer do this, for the
> reason I'm describing now). If you change the value of $USER, any
> such things may break. Generally the convention is to use upper case
> names for environment variables (i.e. things you want to have
> persistence across sessions/processes/etc.), and shell scripts should
> use lower case names for their variables to avoid unintended conflicts
> like this.
Yes, using upper case for environment variables and lower case for local
variables is the long-time Unix/Linux convention. Shell scripts can use
both local as well as environment variables. I think your definition of
persistence is incorrect.
Environment variables persist within the process where they were
created, and any child process. However, a child process cannot affect
an environment variable in a parent or sibling process. There are a few
builtin environment variables. HOME and USER are two that are used
frequently.
--
Jerry Feldman <gaf at blu.org>
Boston Linux and Unix
PGP key id:3BC1EB90
PGP Key fingerprint: 49E2 C52A FC5A A31F 8D66 C0AF 7CEA 30FC 3BC1 EB90
More information about the Discuss
mailing list