[PLUG] Bourne Scripting Question

Diego Zamboni zamboni@cerias.purdue.edu
Sat, 24 Feb 2001 13:14:54 -0500


> I have a tarball that is named after the USER of the script (named for
> the $USER variable).  I want to untar it.  why doesn't tar -xf $USER
> work?  I'm doing this on mentor, so I'm using their foul tar program...

What doesn't work? What error are you getting?

Is $USER the name of the file, or $USER.tar, or someting else?
Maybe tar -xf $USER.tar will work?

Also, not every shell sets the USER variable, AFAIK. In my system, tcsh
sets USER, but ksh and sh don't. Maybe the variable is not defined at
all. Getting the user name using whoami or "who am i" (with some
postprocessing) might be a more portable (for some value of "portable")
solution.

--Diego