Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2003
    Posts
    8

    Unanswered: shell built-in command in scripts

    shell built-in command
    How do you run a "shell built-in command" inside a Unix shell script?

    I'm trying to source a startup file but when I execute the file an error occurs

    #!/bin/sh
    echo "start"
    source .cshrc
    echo "finish"

    colt 27% temp
    start
    temp[3]: source: not found
    finish
    colt 28%

    Is there anyway to do this?

    Thanks

    Marty

  2. #2
    Join Date
    Oct 2003
    Location
    East Coast of South Africa
    Posts
    10
    I notice that you are trying to source a c shell source while starting the script in sh. any reason for this? try /bin/csh and use

    source filenale (without the .cshrc - this is automatic)

    Can you expand on what you are trying to do. Are you looking to access the parent shell or the child shell?
    Last edited by EZEE!; 10-15-03 at 09:46.

  3. #3
    Join Date
    Apr 2003
    Posts
    8
    I'm writting a script that sources the .cshrc so the user does not have to do it manually.

    The .cshrc contains many setenv. Is there away in a script to run set these?

    Thanks

    Marty

  4. #4
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    12
    Two ways :-

    1. Use #!/bin/sh on the first line of the script and do a
    . /xyz/.profile

    2. Use #!/bin/csh on the first line of the script and do a
    source /xyz/.cshrc
    Thanks and Regards
    Karthik R

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •