Results 1 to 14 of 14

Thread: shell script

  1. #1
    Expert Member
    Join Date
    Dec 2006
    Answers
    204

    shell script

    anyone please suggest me tutorial for database connectivity in unix shell scripts?
    i think we can use the same commands we run in the shell prompt. is it?


  2. #2
    Junior Member
    Join Date
    Feb 2007
    Answers
    1

    Re: shell script

    Thanks Barbie for asking this query.

    I too wanted to get to know about this.


  3. #3
    Expert Member
    Join Date
    Dec 2006
    Answers
    204

    Re: shell script

    Hi shal raji,
    i learnt about it.
    there is no special syntax to do this.
    just connect to database using "sqlplus" as u will do in shell prompt and go on with ur sql queries. thats it.

    but i don know any link to learn about this. if i get to know any link, i will it post here.


  4. #4
    Junior Member
    Join Date
    Jul 2008
    Answers
    6

    Re: shell script

    there is no special command for data base connectivity
    i use informix database with unix
    i write all informix command in a shell
    and if executed with authentication to data base the result is same
    i am able to mix normal scripting command with database command
    i enables me do write database related cron very easily


  5. #5
    Junior Member
    Join Date
    Aug 2008
    Answers
    4

    Re: shell script

    isql -s$servername -u$username -p$password this is the syntax i think...


  6. #6
    Junior Member
    Join Date
    Aug 2008
    Answers
    1

    Re: shell script

    Quote Originally Posted by Barbie View Post
    anyone please suggest me tutorial for database connectivity in unix shell scripts?
    i think we can use the same commands we run in the shell prompt. is it?
    yes u can use the same commands that u use in shell. But u have to set oracle's environment variables in the script.


  7. #7
    Junior Member
    Join Date
    Aug 2008
    Answers
    4

    Re: shell script

    ls –l|grep –v ‘..\.’ what is themeaning of this command


  8. #8
    Junior Member
    Join Date
    Aug 2008
    Answers
    1

    Re: shell script

    This expression filters out all the files listed out by the commands 'ls -l' and the removes the files having names containing the DOT (.) character.
    grep is for pattern matching. grep with '-v' takes out only those which don't match that pattern. In the pattern. '\.' refers to the dot character. The other dots refer to any one or more occurance of the said character.
    Pl note that apparently it may lists out the directoies (because directory names have no dot usually), but it is not. You get the same result for '.\.' also.
    Hope you have got the answer.


  9. #9
    Junior Member
    Join Date
    Mar 2006
    Answers
    12

    Re: shell script

    Just write a shell script:- sample posted below
    result=`sqlplus -s har/har <<eof!
    set feedback off
    set heading off
    set verify off
    select count(*) from table.abc@cinder;
    commit;
    exit
    eof!`


  10. #10
    Junior Member
    Join Date
    Aug 2008
    Answers
    2

    Re: shell script

    isql
    An interactive command-line shell that allows executing SQL statements

    isql -S<server> -U<user id> -P<password> -c -w 20000000000 use <dbname>

    Example:
    isql –SNYP_LASER1 -Umacigrab -Pmacigrab -c -w 20000000000 use dbloan
    1> SELECT COUNT(*) FROM agreements
    2>

    -----------
    363

    (1 row affected)
    1> SELECT MAX(agreement_id) FROM agreements
    2>

    -----------
    365

    (1 row affected)
    1> exit


  11. #11
    Junior Member
    Join Date
    Aug 2008
    Answers
    2

    Talking Re: shell script

    isql
    An interactive command-line shell that allows executing SQL statements

    isql -S<server> -U<user id> -P<password> -c -w 20000000000 use <dbname>

    Example:
    isql –SNYP_LASER1 -Umacigrab -Pmacigrab -c -w 20000000000 use dbloan
    1> SELECT COUNT(*) FROM agreements
    2>

    -----------
    363

    (1 row affected)
    1> SELECT MAX(agreement_id) FROM agreements
    2>

    -----------
    365

    (1 row affected)
    1> exit


    See if this works...since it has worked for me but again it quite customized utility provided.....


  12. #12
    Junior Member
    Join Date
    Sep 2008
    Answers
    1

    Re: shell script

    i cannot understand the following shellscript,i will be thankfull if tell me the answer.

    write a shell script that receive a login name interactively and display the details of the users on the display screen in an easily understandamle format


  13. #13

    Re: shell script

    well u can try this
    I guess it should work.

    ==========================================
    echo "Enter username : "
    read uname
    echo "The username entered is $uname"
    echo `finger $uname`
    ==========================================

    Let me know if it works.


  14. #14
    Junior Member
    Join Date
    Oct 2008
    Answers
    1

    Re: shell script

    Quote Originally Posted by Barbie View Post
    anyone please suggest me tutorial for database connectivity in unix shell scripts?
    i think we can use the same commands we run in the shell prompt. is it?
    hi, you all about 1)unix shell 2)shell scripting
    3)databasefile. othere simple shell scripting to write useing cut,sort,and grep
    using.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact