Unix Technical Forum

$TEMP or $TMP?

This is a discussion on $TEMP or $TMP? within the Slackware Linux Support forums, part of the Unix Operating Systems category; --> was updating some of my scripts yesterday... noticed a lack of a variable for TEMP or TMP or tmp ...


Go Back   Unix Technical Forum > Unix Operating Systems > Slackware Linux Support

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-20-2008, 07:28 AM
ray
 
Posts: n/a
Default $TEMP or $TMP?

was updating some of my scripts yesterday... noticed a lack of a
variable for TEMP or TMP or tmp or temp... I know I can use /tmp/ but in
windows I've gotten used to using %temp% being "just there" as an
envvar... what do you guys do? Assume /tmp/ is there? create a ~/tmp/
as needed?

Ray

(who likes %TEMP% in windows especially since they went to c:\documents
and settings\username\blah\blah\blah\temp....)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-20-2008, 07:28 AM
Lew Pitcher
 
Posts: n/a
Default Re: $TEMP or $TMP?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

ray wrote:
> was updating some of my scripts yesterday... noticed a lack of a
> variable for TEMP or TMP or tmp or temp... I know I can use /tmp/ but in
> windows I've gotten used to using %temp% being "just there" as an
> envvar... what do you guys do? Assume /tmp/ is there? create a ~/tmp/
> as needed?


Well, first of all, /tmp is /required/ to be there. It's job as a
directory is to be the host to temporary files from any user process.
/tmp exists, or your system is as broken as WinXP without a %SYSTEM%
directory. The tools and functions that manipulate temporary files do so
in /tmp (but can be overridden to do so in some other directory).

Secondly, while the environment variable $TMP or $TEMP isn't standard,
there's nothing stopping you from setting up one:
echo 'export TMP=/tmp' >>/etc/profile
echo 'export TEMP=/tmp' >>/etc/profile
or
echo 'export TMP=/tmp' >>~/.profile
echo 'export TEMP=/tmp' >>~/.profile

HTH
- --

Lew Pitcher, IT Specialist, Enterprise Data Systems
Enterprise Technology Solutions, TD Bank Financial Group

(Opinions expressed here are my own, not my employer's)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)

iD8DBQFCVCXZagVFX4UWr64RAvGuAJsEl8Xw+UetGS15XxBsi8 vDyVa7bACbBR3l
Uv2xP22ahmaqo4uIO388ghA=
=KCCM
-----END PGP SIGNATURE-----
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-20-2008, 07:30 AM
ray
 
Posts: n/a
Default Re: $TEMP or $TMP?

Lew Pitcher wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> ray wrote:
>
>>was updating some of my scripts yesterday... noticed a lack of a
>>variable for TEMP or TMP or tmp or temp... I know I can use /tmp/ but in
>>windows I've gotten used to using %temp% being "just there" as an
>>envvar... what do you guys do? Assume /tmp/ is there? create a ~/tmp/
>>as needed?

>
>
> Well, first of all, /tmp is /required/ to be there. It's job as a
> directory is to be the host to temporary files from any user process.
> /tmp exists, or your system is as broken as WinXP without a %SYSTEM%
> directory. The tools and functions that manipulate temporary files do so
> in /tmp (but can be overridden to do so in some other directory).
>


I know I can create an envvar, I guess I was just surprised to not find
it already defined. How do you know that /tmp is "required"? Not
really trying to argue, but does the kernel source spell out /tmp as a
requirement? Do programs just assume it's there and properly mounted?

oh, and it's %systemroot% - there's no %system% var.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-20-2008, 07:30 AM
Laurenz Albe
 
Posts: n/a
Default Re: $TEMP or $TMP?

ray <nospam@example.com> wrote:
> How do you know that /tmp is "required"? Not
> really trying to argue, but does the kernel source spell out /tmp as a
> requirement? Do programs just assume it's there and properly mounted?


The POSIX standard requires that there is a /tmp directory.
You may rely on the existence of that directory.

Yours,
Laurenz Albe
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-20-2008, 07:30 AM
Eef Hartman
 
Posts: n/a
Default Re: $TEMP or $TMP?

Laurenz Albe <albe@culturallnospam.com> wrote:
>> requirement? Do programs just assume it's there and properly mounted?

>
> The POSIX standard requires that there is a /tmp directory.
> You may rely on the existence of that directory.


In multi-user level, that is. Single user there MAY not be a /tmp
present cq mounted yet.
--
************************************************** ******************
** Eef Hartman, Delft University of Technology, dept. EWI/TW **
** e-mail: E.J.M.Hartman@math.tudelft.nl, fax: +31-15-278 7295 **
** snail-mail: P.O. Box 5031, 2600 GA Delft, The Netherlands **
************************************************** ******************
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-20-2008, 07:31 AM
ray
 
Posts: n/a
Default Re: $TEMP or $TMP?

Laurenz Albe wrote:
> ray <nospam@example.com> wrote:
>
>> How do you know that /tmp is "required"? Not
>>really trying to argue, but does the kernel source spell out /tmp as a
>>requirement? Do programs just assume it's there and properly mounted?

>
>
> The POSIX standard requires that there is a /tmp directory.
> You may rely on the existence of that directory.
>
> Yours,
> Laurenz Albe


Works for me. Thank you for clearing that up.
I learn something new every day.

Ray
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:40 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com