Find the answer to your Linux question:
Results 1 to 2 of 2
I have a bash script named ztest that looks like this: --------------- #!/bin/bash ls -lat --------------- On server A it works fine, and I get a directory listing. On server ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jan 2006
    Posts
    1

    Bash scripts do not echo commands


    I have a bash script named ztest that looks like this:
    ---------------
    #!/bin/bash

    ls -lat

    ---------------

    On server A it works fine, and I get a directory listing.

    On server B I get nothing. As though the script did not execute!

    However, I modified the script:
    ---------------
    #!/bin/bash

    ls -lat $1 >zresult

    ---------------

    When I execute the following:
    #./ztest
    #cat zresult

    I see the directory.
    And if I execute the following:
    #./ztest /etc/init.d/
    #cat zresult

    I see the /etc/init.d/ directory.
    Bottom line: The bash script is executing.
    But I am not getting/seeing any output from the script.
    I have tried echo commands, >stdout, etc. but no such luck!

    I am ssh'd into the server using PuTTY.
    But I have no idea if this is a system configuration issue? A PuTTY issue? Some other issue?

    Any ideas?
    Sean McCoy
    sean@responsivedata.com

  2. #2
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    What if you put an obviously invalid command, like `jifds' in the script? Do you then get the diagnostic message saying that it didn't find jifds?

Posting Permissions

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