Environment Variable or Directory - Unix

This is a discussion on Environment Variable or Directory - Unix ; A colleague of mine ran a process on one of the Solaris servers that caused the creation of the directory $PS_SERVDIR: pfs880@justice> ls -l total 32 drwxr-x--- 3 pfs880 pfs880 96 Apr 4 12:46 $PS_SERVDIR -rwxr-xr-x 1 pfs880 pfs880 366 ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: Environment Variable or Directory

  1. Environment Variable or Directory

    A colleague of mine ran a process on one of the Solaris servers that
    caused the creation of the directory $PS_SERVDIR:

    pfs880@justice> ls -l
    total 32
    drwxr-x--- 3 pfs880 pfs880 96 Apr 4 12:46 $PS_SERVDIR
    -rwxr-xr-x 1 pfs880 pfs880 366 Apr 3 13:56 emf_psae.sh
    drwxr-x--- 2 pfs880 pfs880 96 Apr 1 17:56 ids
    -rwxr-xr-x 1 pfs880 pfs880 1237 Dec 8 2003 matchers.xml

    A listing of the directory shows:

    pfs880@justice> ls -l $PS_SERVDIR
    total 32
    drwxr-x--- 3 pfs880 pfs880 96 Apr 4 12:46 $PS_SERVDIR
    -rwxr-xr-x 1 pfs880 pfs880 366 Apr 3 13:56 emf_psae.sh
    drwxr-x--- 2 pfs880 pfs880 96 Apr 1 17:56 ids
    -rwxr-xr-x 1 pfs880 pfs880 1237 Dec 8 2003 matchers.xml

    Does this indicate PS_SERVDIR is an env. variable?
    Let's see:

    pfs880@justice> echo $PS_SERVDIR

    does not return any value for this variable.

    But,

    pfs880@justice> pwd
    /fin01/home/pfs880/pt845/PSEMAgent/envmetadata/data
    pfs880@justice> cd
    pfs880@justice> pwd
    /fin01/home/pfs880
    pfs880@justice> ls -l
    total 49472
    -rw-r----- 1 pfs880 pfs880 25262512 Apr 29 2005
    AE_PC_PRICING_903.AET.bak
    -rw-r----- 1 pfs880 pfs880 29480 Apr 29 2005
    AE_PC_PRICING_903_tail_1k.AET
    drwxr-x--- 2 pfs880 pfs880 96 Sep 28 2005 cd84517
    -rw-r----- 1 pfs880 pfs880 137 Sep 11 2005 cleanup_core.sh
    -rw------- 1 pfs880 pfs880 2304 Dec 15 20:32 dead.letter
    -rw-r----- 1 pfs880 pfs880 648 Jan 29 11:22 pfs880.crontab
    drwxr-x--- 19 pfs880 pfs880 8192 Dec 2 14:08 pt845
    -rw-r----- 1 pfs880 pfs880 0 Sep 30 2005 vpd.properties
    pfs880@justice> ls -l $PS_SERVDIR
    total 49472
    -rw-r----- 1 pfs880 pfs880 25262512 Apr 29 2005
    AE_PC_PRICING_903.AET.bak
    -rw-r----- 1 pfs880 pfs880 29480 Apr 29 2005
    AE_PC_PRICING_903_tail_1k.AET
    drwxr-x--- 2 pfs880 pfs880 96 Sep 28 2005 cd84517
    -rw-r----- 1 pfs880 pfs880 137 Sep 11 2005 cleanup_core.sh
    -rw------- 1 pfs880 pfs880 2304 Dec 15 20:32 dead.letter
    -rw-r----- 1 pfs880 pfs880 648 Jan 29 11:22 pfs880.crontab
    drwxr-x--- 19 pfs880 pfs880 8192 Dec 2 14:08 pt845
    -rw-r----- 1 pfs880 pfs880 0 Sep 30 2005 vpd.properties

    Unsetting the variable does not help.
    I need to remove the directory $PS_SERVDIR without removing any files.
    Have any idea what this thing is?

    Thanks in advance for any help you can provide.


  2. Re: Environment Variable or Directory

    On 6 Apr 2006 13:36:14 -0700, MK wrote:

    > A colleague of mine ran a process on one of the Solaris servers that
    > caused the creation of the directory $PS_SERVDIR:




    Any time you need to escape a character try using a \

    $ mkdir \$PS_SERVDIR
    $ ls -al
    drwx------ 6 bittwister bittwister 4,096 Apr 6 15:44 .
    drwx--x--x 33 bittwister bittwister 4,096 Apr 6 14:13 ..

    drwx------ 2 bittwister bittwister 4,096 Apr 6 07:06 ksocket-bittwister
    drwxr-xr-x 2 bittwister bittwister 4,096 Apr 6 15:44 $PS_SERVDIR



    $ rmdir \$PS_SERVDIR
    $ ls -al
    drwx------ 5 bittwister bittwister 4,096 Apr 6 15:44 .
    drwx--x--x 33 bittwister bittwister 4,096 Apr 6 14:13 ..

    drwx------ 2 bittwister bittwister 4,096 Apr 6 07:06 ksocket-bittwister
    -rw-r--r-- 1 bittwister bittwister 88 Apr 1 09:05 msg____
    drwx------ 2 bittwister bittwister 4,096 Apr 6 07:10 orbit-bittwister

    > I need to remove the directory $PS_SERVDIR without removing any files.


    Then rename it.

    mv \$PS_SERVDIR new_dir_name_here


  3. Re: Environment Variable or Directory

    On 2006-04-06, MK wrote:
    > A colleague of mine ran a process on one of the Solaris servers that
    > caused the creation of the directory $PS_SERVDIR:
    >
    > pfs880@justice> ls -l
    > total 32
    > drwxr-x--- 3 pfs880 pfs880 96 Apr 4 12:46 $PS_SERVDIR
    > -rwxr-xr-x 1 pfs880 pfs880 366 Apr 3 13:56 emf_psae.sh
    > drwxr-x--- 2 pfs880 pfs880 96 Apr 1 17:56 ids
    > -rwxr-xr-x 1 pfs880 pfs880 1237 Dec 8 2003 matchers.xml
    >
    > A listing of the directory shows:
    >
    > pfs880@justice> ls -l $PS_SERVDIR


    Since nothing is stored in the variable, that's the same as:

    ls -l

    > total 32
    > drwxr-x--- 3 pfs880 pfs880 96 Apr 4 12:46 $PS_SERVDIR
    > -rwxr-xr-x 1 pfs880 pfs880 366 Apr 3 13:56 emf_psae.sh
    > drwxr-x--- 2 pfs880 pfs880 96 Apr 1 17:56 ids
    > -rwxr-xr-x 1 pfs880 pfs880 1237 Dec 8 2003 matchers.xml
    >
    > Does this indicate PS_SERVDIR is an env. variable?


    No, it means that there is a directory named '$PS_SERVDIR'

    > Let's see:
    >
    > pfs880@justice> echo $PS_SERVDIR
    >
    > does not return any value for this variable.
    >
    > But,
    >
    > pfs880@justice> pwd
    > /fin01/home/pfs880/pt845/PSEMAgent/envmetadata/data
    > pfs880@justice> cd
    > pfs880@justice> pwd
    > /fin01/home/pfs880
    > pfs880@justice> ls -l
    > total 49472
    > -rw-r----- 1 pfs880 pfs880 25262512 Apr 29 2005 AE_PC_PRICING_903.AET.bak
    > -rw-r----- 1 pfs880 pfs880 29480 Apr 29 2005 AE_PC_PRICING_903_tail_1k.AET
    > drwxr-x--- 2 pfs880 pfs880 96 Sep 28 2005 cd84517
    > -rw-r----- 1 pfs880 pfs880 137 Sep 11 2005 cleanup_core.sh
    > -rw------- 1 pfs880 pfs880 2304 Dec 15 20:32 dead.letter
    > -rw-r----- 1 pfs880 pfs880 648 Jan 29 11:22 pfs880.crontab
    > drwxr-x--- 19 pfs880 pfs880 8192 Dec 2 14:08 pt845
    > -rw-r----- 1 pfs880 pfs880 0 Sep 30 2005 vpd.properties
    > pfs880@justice> ls -l $PS_SERVDIR
    >
    > total 49472
    > -rw-r----- 1 pfs880 pfs880 25262512 Apr 29 2005 AE_PC_PRICING_903.AET.bak
    > -rw-r----- 1 pfs880 pfs880 29480 Apr 29 2005 AE_PC_PRICING_903_tail_1k.AET
    > drwxr-x--- 2 pfs880 pfs880 96 Sep 28 2005 cd84517
    > -rw-r----- 1 pfs880 pfs880 137 Sep 11 2005 cleanup_core.sh
    > -rw------- 1 pfs880 pfs880 2304 Dec 15 20:32 dead.letter
    > -rw-r----- 1 pfs880 pfs880 648 Jan 29 11:22 pfs880.crontab
    > drwxr-x--- 19 pfs880 pfs880 8192 Dec 2 14:08 pt845
    > -rw-r----- 1 pfs880 pfs880 0 Sep 30 2005 vpd.properties
    >
    > Unsetting the variable does not help.
    > I need to remove the directory $PS_SERVDIR without removing any files.
    > Have any idea what this thing is?


    It's a directory. If you want to remove it:

    rmdir '$PS_SERVDIR'

    Or:

    rm -rf '$PS_SERVDIR'

    --
    Chris F.A. Johnson, author |
    Shell Scripting Recipes: | My code in this post, if any,
    A Problem-Solution Approach | is released under the
    2005, Apress | GNU General Public Licence

  4. Re: Environment Variable or Directory

    I tried using the single quotes and that did no do it, but escaping the
    $ with \ did it!!
    Thanks to everyone who replied.


+ Reply to Thread