Find the answer to your Linux question:
Results 1 to 4 of 4
I entered the following commands one by one and worked very fine in RedHat. service squid stop rpm -e squid rpm -ivh /root/squid-2.4.STABLE6-1.7.2.i386.rpm cd /etc/squid cp squid.conf.rpmsave squid.conf service squid ...
  1. #1
    Just Joined!
    Join Date
    Jan 2009
    Posts
    3

    A script worked improperly

    I entered the following commands one by one and worked very fine in RedHat.

    service squid stop
    rpm -e squid
    rpm -ivh /root/squid-2.4.STABLE6-1.7.2.i386.rpm
    cd /etc/squid
    cp squid.conf.rpmsave squid.conf
    service squid start

    When I saved them as a script, it didn't work properly.
    (add #!/bin/sh and chmod 755)

    Can anyone tell me how to solve this problem?

    Thank you very much!

  2. #2
    Linux User
    Join Date
    Jun 2007
    Posts
    318
    Need more information.

    What command did you use to run the script.
    What was the error message.
    Post the script

  3. #3
    Just Joined!
    Join Date
    Jan 2009
    Posts
    3
    Quote Originally Posted by vsemaska View Post
    Need more information.

    What command did you use to run the script.
    What was the error message.
    Post the script
    I saved the following commands

    #!/bin/bash
    service squid stop
    rpm -e squid
    rpm -ivh /root/squid-2.4.STABLE6-1.7.2.i386.rpm
    cd /etc/squid
    cp squid.conf.rpmsave squid.conf
    service squid start

    into a file called "reborn" and chmod it to 755.

    I thought that as I typed "reborn" and the system showed me "command not found".

    But I typed "./reborn" and it worked pretty good.

    I am a Linux beginner.

    Actually, I don't know the difference between "bash" and "sh".

    Thanks for your helps.

  4. #4
    Linux User
    Join Date
    Jun 2007
    Posts
    318
    Forgetting the './' in front of the script is a common mistake by beginners. The './' means to look for the script in the current directory. If you forget the './' Linux looks for the script in the directories listed in the PATH variable. You can see that with:

    Code:
    echo $PATH
    In Linux "bash" and "sh" are the same thing. /bin/sh is what's called a symbolic link that points to /bin/bash.

Posting Permissions

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