LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-13-2006, 07:36 PM   #1
sean@responsivedata.
LQ Newbie
 
Registered: Jan 2006
Posts: 10

Rep: Reputation: 0
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
 
Old 01-13-2006, 07:45 PM   #2
accessrichard
Member
 
Registered: Apr 2005
Distribution: Fedora Core (latest version)
Posts: 156

Rep: Reputation: 30
Are you sure ztest is executable on server b.

chmod +x ztest
 
Old 01-13-2006, 07:49 PM   #3
sean@responsivedata.
LQ Newbie
 
Registered: Jan 2006
Posts: 10

Original Poster
Rep: Reputation: 0
Yes.
chmod 0755 ztest

And per my post, when the script directs output to a file, I can see the results in that file.
So I know the script is executing.
I just cannot see any of my commands being echoed.
 
Old 01-13-2006, 09:03 PM   #4
zhy2111314
Member
 
Registered: Aug 2005
Location: China
Distribution: redhat(Fedora Core)->Debian Sid->Slackware
Posts: 91

Rep: Reputation: 15
I think that's something about FD(file descriptor). That means something about redirection in server b is changed because the default stdout device is Screen, but now it's obvious not. But unfortunately I didnot know which place to do this kinda changes. I am searching for it now.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash scripts do not echo commands sean@responsivedata. Linux - Newbie 9 01-17-2006 10:25 AM
Bash Scripting - echo command question gbhil Programming 2 04-27-2005 07:27 PM
can echo be used for popups in shell scripts run by cron? dr_zayus69 Linux - Software 4 04-12-2005 06:30 PM
Issuing Telnet commands via bash scripts Kaj Programming 2 01-02-2005 11:44 PM
How to echo variables and commands in one line? hindll01 Programming 1 09-10-2004 06:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration