regarding shell scripts and database function.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • creeds
    New Member
    • Feb 2008
    • 14

    regarding shell scripts and database function.

    hello,
    i have a problem regarding following scenario,
    ------------------
    #!/bin/sh
    read $no

    output=$(/usr/local/pgsql/bin/psql -d hrcurrency -t -c "select fn_deleteradno( no)")

    echo $output

    -----------------
    My problem is how to pass the value read from the console to the function
    fn_deleteradno( no)

    if i straight away give the number by hard coring it in the function, it works fine.
  • gpraghuram
    Recognized Expert Top Contributor
    • Mar 2007
    • 1275

    #2
    Originally posted by creeds
    hello,
    i have a problem regarding following scenario,
    ------------------
    #!/bin/sh
    read $no

    output=$(/usr/local/pgsql/bin/psql -d hrcurrency -t -c "select fn_deleteradno( no)")

    echo $output

    -----------------
    My problem is how to pass the value read from the console to the function
    fn_deleteradno( no)

    if i straight away give the number by hard coring it in the function, it works fine.
    output=$(/usr/local/pgsql/bin/psql -d hrcurrency -t -c "select fn_deleteradno( $no)")

    You have to use $var to get the value

    raghuram

    Comment

    Working...