Find the answer to your Linux question:
Results 1 to 3 of 3
Hi All I have a just completed a clean install of Suse 9.2. All went very well, including the dreaded NVIDIA driver set-up. I would now like to have a ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie
    Join Date
    Aug 2004
    Location
    Malvern, UK
    Posts
    132

    New to Bash Scripting - Problems !


    Hi All

    I have a just completed a clean install of Suse 9.2. All went very well, including the dreaded NVIDIA driver set-up.

    I would now like to have a go at learning shell scripting but am a little confused by the ".bashrc", ".profile" setup.

    I have a bin directory in /home, and I have written a small test script but I cannot get it to work. From what I have read I believe that I have not got the above files set up properly. I want to add:

    Code:
    #home/stu/bin
    to my $PATH but the contents of the Suse bash files do not bear any resemblance to those described in the tutorial I am following.

    My current $PATH is as follows:

    Code:
     
    echo $PATH 
     /home/stu/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/games: 
     /opt/gnome/bin:/opt/kde3/bin:/usr/lib/jvm/jre/bin
    When I run the script, either by prefixing with "./" within the /home/stu/bin, or just entering the script name at the prompt, I get this error:

    Code:
    stu@linux:~> my_script 
     bash: /home/stu/bin/my_script: bin/bash: bad interpreter: No such file or directory
    Can anyone offer any advice on how to setup my /home so that I can run scripts from anywhere. This is my first venture into scripting (or any sort of programming) and I can't seem to get things started. I am probably missing something very simple but I just can't see it.

    Thanks in Advance

    Bubo
    My Computer Once Beat Me at Chess, but it is No Match for Me at Kickboxing !

    Registered Linux User: #417183

  2. #2
    Linux Enthusiast
    Join Date
    Jan 2005
    Posts
    575
    I suspect that the first line of your script is #!bin/bash when it should be #!/bin/bash
    The interpreter at the beginning of a script should be given as
    a full pathname not a relative one.

    Another way to run scripts is to omit the #! line at the beginning
    and type instead source name_of_script

  3. #3
    Linux Newbie
    Join Date
    Aug 2004
    Location
    Malvern, UK
    Posts
    132
    I do feel very silly now !

    Thanks very much for the pointer.

    Bubo.
    My Computer Once Beat Me at Chess, but it is No Match for Me at Kickboxing !

    Registered Linux User: #417183

Posting Permissions

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