Sponsored Content
Top Forums UNIX for Beginners Questions & Answers What will be the effect of environment variable, when mulitple sessions are opened by same login? Post 302981443 by rbatte1 on Tuesday 13th of September 2016 07:20:45 AM
Old 09-13-2016
Each session will keep it's own version of the environmental variable and it's value. There could be contention if you are writing files of the same name to the same directory I suppose, but processes of one session cannot generally be affected by those in another, even if it is the same user account.

If you need to ensure they work with separate directories, you could do this:-
Code:
my_dir=$(mktemp -d)

This will create a unique directory in /tmp. You can change that if you like to create a unique directory under a path you specify, especially if your files are large or the data is sensitive:-
Code:
my_dir=$(mktemp -d /path/to/base/dir)


I hope that this helps,
Robin
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

remote startup of login & sessions

Hello All, I would like to know if anyone has done or has information on how to start a workstation up form another remote station. For example I am sitting at station A and I want to start up a session on station B, setting display to output on station B "0.0". Here is the tricky part station... (2 Replies)
Discussion started by: larry
2 Replies

2. AIX

AIX Login sessions

In AIX v5.2 is there a way to restrict the number of telnet sessions for a particular user ? Say, i want restrict the number of simultaneous telnet session for a particular user to be 3. How do i achieve this. Appreicate your help (1 Reply)
Discussion started by: rramanuj
1 Replies

3. Linux

Unable to login with root for more than 2 sessions

Hi, I am unable to login with root for more than 2 sessions. Plz help any thing need to updated? Suresh (2 Replies)
Discussion started by: suresh3566
2 Replies

4. Shell Programming and Scripting

Expand an environment variable in sed, when the variable contains a slash

I'm trying to make a sed substitution where the substitution pattern is an environment variable to be expanded, but the variable contains a "slash". sed -e 's/<HOME_DIRECTORY>/'$HOME'/'This gives me the following error: sed: -e expression #1, char 21: unknown option to `s'Obviously this is... (2 Replies)
Discussion started by: Ilja
2 Replies

5. UNIX for Dummies Questions & Answers

Can't login to a free shell environment

I would like to practice shell scripting and need an environment - free shell account. I tried Arbornet and the freeshell.org. But both always give me error: "File operations disabled, server identity can't be verified". Any idea what I should do? thanks in advance. (9 Replies)
Discussion started by: laiko
9 Replies

6. Shell Programming and Scripting

File exists, but cannot be opened.How to check- whether it could be opened to read when it exists

Hi #Testing for file existence if ; then echo 'SCHOOL data is available for processing' else echo 'SCHOOL DATA IS NOT AVAILABLE FOR PROCESSING' : i wrote a script, where it begins by checking if file exists or not. If it exists, it truncates the database... (2 Replies)
Discussion started by: rxg
2 Replies

7. AIX

3004-312 All available login sessions are in use.

Hello, I have a strange situation here. I am running an AIX6.1 machine and i face a problem when i am trying to login via telnet. When i use my username and password to login to the server i get the following message: 3004-312 All available login sessions are in use. The weird thing is that... (3 Replies)
Discussion started by: omonoiatis9
3 Replies

8. UNIX for Advanced & Expert Users

Can adding to a new group be effective in current login environment without re-login?

Hey folks, When a user is added to a new group, the user has to be log out and log in again to make the new group effective. Is there any system command or technique to refresh user group ID update without re-login? I am not talking about to use "login" or "su -l" commands which can only make... (2 Replies)
Discussion started by: hce
2 Replies

9. Solaris

How to search for the sessions that have a certain environment variable set?

Hi all, In Solaris 10, is there a way to search for the sessions that have a certain environment variable set? (8 Replies)
Discussion started by: ejianu
8 Replies

10. UNIX for Beginners Questions & Answers

Non-interactive & non-login shell environment?

Hello and thanks in advance for any help anyone can offer to straighten me out on this subject I'm trying to understand non-interactive & non-login shells and having a hard time conceptualize the process a non-interactive & non-login shell goes through to start up. Particularly for background... (7 Replies)
Discussion started by: bodisha
7 Replies
mktemp(1)						      General Commands Manual							 mktemp(1)

Name
       mktemp - make a name for a temporary file

Syntax
       mktemp [ -c ] [ -d directory_name ] [ -p prefix ]

Description
       The  command makes a name for the pathname of a temporary file and writes that name to standard output. The name will not duplicate that of
       an existing file. The command does not create a new file. The file named must actually be created before can generate a new filename.

       Subsequent calls to will only generate a new file name if all previously generated file names have been	created  by  the  user	and  still
       exist.  Error messages are written to standard error.

       The  directory_name generated by is the concatenation of a directory name, a slash (/), a file prefix, a dot (.), a four digit number and a
       unique character.

       The directory name is chosen as follows:

	  (1)  If the -d option is specified, directory_name is used.

	  (2)  Otherwise, if the TMPDIR environment variable is set and a string that would yield a unique name can be obtained using the value of
	       that variable as a directory name, this value is used.

	  (3)  Otherwise, is used.

       The prefix is chosen as follows:

	  (1)  If the -p option is specified, prefix is used.

	  (2)  Otherwise, if the LOGNAME environment variable is set, it is used as the prefix.

	  (3)  Otherwise, the user's login name is used.

Options
       -c	   Causes to attempt to create a regular file using the generated (or created) name string. If file creation is successful, a zero
		   length file is created with access permissions derived from the process's file mode creation mask, see No attempt  is  made	to
		   create  a file if the length of the generated (or created) name string exceeds 1023 characters. It is the user's responsibility
		   to remove files created by use of this option.

       -d directory_name
		   Causes directory_name to be used as the directory portion of the pathname. In this case,  directory_name  is  used  instead	of
		   TMPDIR and

       -p prefix   Causes  the string prefix to be used as the file's prefix.  It is used instead of LOGNAM and the user's login name. If the pre-
		   fix is longer the 249 characters, it will be silently truncated to that length before the concatenation of the suffix.

Environmental Variables
       LOGNAME	   When the -p prefix option is not specified, the value of this variable is used as the prefix of the filename, if it exists.

       TMPDIR	   When the -d directory_name option is not specified, the value of this variable is used instead of

Restrictions
       If the user does not have write permission in the directory specified, and error message is reported and is used in its place.  The  entire
       path name can not exceed 1023 characters, and the temporary file name can not exceed 255 characters. If the generated file name is too long
       it is truncated to fit before the suffix is added.

See Also
																	 mktemp(1)
All times are GMT -4. The time now is 03:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy