when i run the command "su postgres"

to do what?...

want to run few commands here but system,exec,backticks wont run

Well, first of all because these are perl commands, but you are in a shell that is a different program. If you want to run perl from here then use a perl script (or perl one liners). Second question, of course you had login in the shell as the plain user postgres, not as superuser root. This user don't have superpowers normally outside postgres databases, so if you use system for example, you have the powers of postgresql user, no more, and some system calls and commands (that are exclusive of root) will fail. To try to use postgres for things unrelated with postgres DB management is probably unwise and if "su" don't ask for a password in "su postgres" you are doing wrong.

if you still think that you need a graphic desktop for postgres user take a look to "adduser", (not necessary and not recommended, but if this make you feel better at the start, you can use it). If you need a graphic access to the database use i.e. pgadmin3, (but psql is perfect for me)


In reply to Re: to run a command from $ shell in perl program by pvaldes
in thread to run a command from $ shell in perl program by ansh batra

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.