Find the answer to your Linux question:
Results 1 to 8 of 8
Hi, I am runnin a CentOS 4.4 Server. I try to launch very basic shell script that I created. The purpose of this script is to laucnh several commands. Unfortunaltely ...
  1. #1
    Just Joined!
    Join Date
    Feb 2008
    Posts
    4

    Prompt prevents me from launching script

    Hi,

    I am runnin a CentOS 4.4 Server.
    I try to launch very basic shell script that I created. The purpose of this script is to laucnh several commands.
    Unfortunaltely it fails and the errors that I have are due to the fact that prompt appears at every command (even if I don't see it) and shrinks all my commands in my script.

    Content of my script :
    cd /usr/local
    tar xvf test.tat

    My prompt looks like this [root@localhot]

    What configuration do I miss ?

    Tks,
    C.

  2. #2
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    Quote Originally Posted by colt54 View Post
    Hi,

    I am runnin a CentOS 4.4 Server.
    I try to launch very basic shell script that I created. The purpose of this script is to laucnh several commands.
    Unfortunaltely it fails and the errors that I have are due to the fact that prompt appears at every command (even if I don't see it) and shrinks all my commands in my script.

    Content of my script :
    cd /usr/local
    tar xvf test.tat

    My prompt looks like this [root@localhot]

    What configuration do I miss ?

    Tks,
    C.
    I don't know how did you reach that conclussion. But the prompt has nothing to do with your prompt.

    Actually, you probably mean "test.tar", instead of "test.tat". Besides that, you need to be aware that users usually don't have write permissions under /usr, so, the extraction on that dir will fail unless you are root.

    If you have errors, paste the exact contents of your script, and the errors that appears in the terminal when launching it.

    EDIT: corrected "prompt" instead of "script". :P

  3. #3
    Just Joined!
    Join Date
    Feb 2008
    Posts
    4
    Hi,

    Thanks for your help. I will try to explain better:
    Here is the content of my script called "step1-Install_Tomcat.sh" :

    gunzip apache-tomcat-6.0.14.tar.gz

    When I try to launch the script by the following command, here is the result I have:

    [root@localhost Colt54EW214]# ./step1-Install_Tomcat.sh
    .gz: No such file or directoryar.gz
    tar: apache-tomcat-6.0.14.tar\r: ne peut open: Aucun fichier ou répertoire de ce type

    If you compare the lenght of my prompt, you will see that it stops at the same point of the ....tar.gz of the command in my script.

    Thanks,
    C.

  4. #4
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    Quote Originally Posted by colt54 View Post
    Hi,

    Thanks for your help. I will try to explain better:
    Here is the content of my script called "step1-Install_Tomcat.sh" :

    gunzip apache-tomcat-6.0.14.tar.gz

    When I try to launch the script by the following command, here is the result I have:

    [root@localhost Colt54EW214]# ./step1-Install_Tomcat.sh
    .gz: No such file or directoryar.gz
    tar: apache-tomcat-6.0.14.tar\r: ne peut open: Aucun fichier ou répertoire de ce type

    If you compare the lenght of my prompt, you will see that it stops at the same point of the ....tar.gz of the command in my script.

    Thanks,
    C.
    Are you sure this tarball is not corrupt?

    Try a little test:

    Code:
    mkdir ~/temp
    cd ~/temp
    tar -cvzf test.tar.gz /etc/init.d/*
    tar -xvzf test.tar.gz
    If that works well, then your gzip files are corrupted. I have never seem a similar error. But the prompt has really nothing to do with the internal behaviour or the programs. If the tarballs are not corrupted, then something must be seriously screwed in your basic system stuff.

    This is a bit strange.

  5. #5
    Just Joined!
    Join Date
    Feb 2008
    Posts
    4
    Yes, the tarball is fine, I can extract it manually without any problem.

  6. #6
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    Quote Originally Posted by colt54 View Post
    Yes, the tarball is fine, I can extract it manually without any problem.
    Do you mean the tarball in my example?

    If that is true then I fear that the problem is in your "apache-tomcat-6.0.14.tar.gz"

  7. #7
    Linux Engineer rcgreen's Avatar
    Join Date
    May 2006
    Location
    the hills
    Posts
    1,114
    gunzip apache-tomcat-6.0.14.tar.gz
    Does this command have any spaces in it, or does it span
    lines? The error says it can't find "ar.gz"
    Try retyping this part of the script. Maybe there's
    hidden corruption in the text, like a stray carriage return.

  8. #8
    Just Joined!
    Join Date
    Feb 2008
    Posts
    4
    OK, problem is solved.
    My script file was in DOS format. I run the dos2unix command on it and the script runs perfectly now.

    Thanks for your help!,
    C.

Posting Permissions

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