The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to get $user in script?

Discussion in 'General Discussion' started by Amanita, Oct 17, 2003.

  1. Amanita

    Amanita Member

    Joined:
    Jan 26, 2003
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Trying to do a serverwide install of a script so I place script in cpanel3-skel which copies it into user directories.

    The first two lines work to get the domains,
    the third line does not get the username.

    partial script...


    $url_to_editor = "http://$domain/editor/editor.cgi";


    $url_to_wrx_library_folder = "http://$domain/editor/wrx_library";


    $path_to_library = "/home/$user/public_html/editor/wrx_library";



    Does anybody know what will get the username?
    I also tried $username & $usr they don't work...

    sigh...
     
  2. asmithjr

    asmithjr Well-Known Member

    Joined:
    Jun 13, 2003
    Messages:
    475
    Likes Received:
    1
    Trophy Points:
    18
    Doesn't "$ENV{DOCUMENT_ROOT}"; give you the users HOME directory.


    So you could use
    $user = "$ENV{DOCUMENT_ROOT}";


    This works in PERL


    That would be $user/editor/wrx_library"; I believe
     
  3. Amanita

    Amanita Member

    Joined:
    Jan 26, 2003
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Woo Hoo! that was it...


    thank you so verrry much!


    :D
     
  4. asmithjr

    asmithjr Well-Known Member

    Joined:
    Jun 13, 2003
    Messages:
    475
    Likes Received:
    1
    Trophy Points:
    18
    NP, Glad I could help
     
  5. danielaugustus

    danielaugustus Well-Known Member

    Joined:
    Oct 15, 2003
    Messages:
    92
    Likes Received:
    0
    Trophy Points:
    6
    I'm trying to put some scripts on self installing option. But I get some problems. cPanel doesnt seem to gimme an option to get the users home directory ( or I dont know ) and I get use DOCUMENR_ROOT since the script is on the cPanel frontend. Does someone knows how can I get the user home directory ?
     
Loading...

Share This Page