Solved

echo commands on a linux script

Posted on 2008-10-18
5
977 Views
Last Modified: 2013-12-16
Hi,

I'm writing a script on Linux Fedora, I would like it to echo the commands it is executing.

Any way to do this ?

Thanks,

siranm
0
Comment
Question by:siranm
  • 2
  • 2
5 Comments
 
LVL 11

Expert Comment

by:jgiordano
ID: 22750618
you could redirect the output but that won't tell you what it is currently executing.

If you want to see the actual command or steps; before each command put, so you know where the script is:

echo "Currently executing command1"
command1


echo "Currently executing command2"
command2
0
 
LVL 3

Author Comment

by:siranm
ID: 22750673
Thanks, that's what i'm actually doing...

But I want to do it like an MS DOS batch, that you can actually see the commands executing....
0
 
LVL 40

Accepted Solution

by:
omarfarid earned 125 total points
ID: 22750675
you could also run it as

bash -x scriptname
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 22750683
Also, you may put

#!/usr/bin/bash
set -x

at the script beginning
0
 
LVL 3

Author Closing Comment

by:siranm
ID: 31507504
i'll give it a try, it seems to work, thanks !
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
AWS RDS 3 64
LINUX, CPANEL & WHM 5 44
Access_log 17 97
Remove a folder in Linux 9 89
This document is written for Red Hat Enterprise Linux AS release 4 and ORACLE 10g.  Earlier releases can be installed using this document as well however there are some additional steps for packages to be installed see Metalink. Disclaimer: I hav…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now