Operating System - HP-UX
1834200 Members
2712 Online
110066 Solutions
New Discussion

Assigning variables to null

 
SOLVED
Go to solution
Michael Campbell
Trusted Contributor

Assigning variables to null

Folks

We need to have variables assigned called GL_SPOOLER during user sign-on for some Openspool print queues. Is it possible to assign these to null for some users who do not need all the useless output that their batch jobs create without causing errors in the batch jobs themselves?

Regards

Michael
4 REPLIES 4
Jean-Louis Phelix
Honored Contributor

Re: Assigning variables to null

hi,

I'm not sure to understand your problem, but :

A - any variable can be set to null, the problem will depend on what your jobs do with them

B - Be careful with '-u' option of shells. In this case, any non set variable reference will generate an error (unset parameter). Use 'set +u' to disable this feature.

Regards
It works for me (© Bill McNAMARA ...)
James R. Ferguson
Acclaimed Contributor
Solution

Re: Assigning variables to null

Hi Michael:

To discard an output stream, redirect the output to '/dev/null'.

It would appear the you could assign this value to GL_SPOOLER assuming that this variable represents the output device:

GL_SPOOLER=/dev/null

Regards!

...JRF...
Shannon Petry
Honored Contributor

Re: Assigning variables to null

Im not sure where this variable is assigned at, but the logic would be as follows.

If the variable is et in /etc/profile (normal system variable location), then add a clause. First make a list of users who do not need the variable.

Then throw a condition into the bottom of the clause to see if the user is in the list.

I.E.
ME=/bin/who am I
NOGLSPOOL=/etc/no_gl_spooler.lst
for I in `cat $NOGLSPOOL` ; do
if [ "$ME" = "$I" ] ; then
GL_SPOOLER=""
else
echo "">>/dev/null
#avoids strange errors
fi
done
Microsoft. When do you want a virus today?
Chuck J
Valued Contributor

Re: Assigning variables to null

Why don't you just assign the variable to /dev/null:

GL_SPOOLER='/dev/null'

Chuck J