> >I have a situation where I need to check the positional parameter, if it is
> >equal to "-display" then I have to assign the next positional parameter to
> >my variable DISPLAY. For this I am running the following script but I am
> >unable to do it. Please help me in solving my problem.
> >for i in $*
> > if [ $i = "-display" ]
> > then
> > shift 1
> > DISPLAY=$i
> > fi
> > break
> >The script will be run like this:
> >$sh abcd.sh abc def -display 220.127.116.11:0 xyz
> There are probably a lot of ways to do that. Here is one.
> for i in $*
> if [ "$i" = "-display" ]
> elif [ $flag -ne 0 ]
> echo $DISPLAY
I corrected my script accordingly, its working fine.
Is there any function/command in shell, similar to the getenv() function in C?
I want to check whether the DISPLAY environment variable is existing or not.
I can check like giving as below. But, is there any other optimal way?
if [ DISPLAY != "" ]
echo DISPLAY defined
echo DISPLAY not defined.