Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

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:
    151
    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:
    507
    Likes Received:
    4
    Trophy Points:
    168
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Amanita

    Amanita Member

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


    thank you so verrry much!


    :D
     
  4. asmithjr

    asmithjr Well-Known Member

    Joined:
    Jun 13, 2003
    Messages:
    507
    Likes Received:
    4
    Trophy Points:
    168
    NP, Glad I could help
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. danielaugustus

    danielaugustus Well-Known Member

    Joined:
    Oct 15, 2003
    Messages:
    92
    Likes Received:
    0
    Trophy Points:
    156
    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

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice