Solved

echo commands on a linux script

Posted on 2008-10-18
5
976 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
Comment Utility
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
Comment Utility
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
Comment Utility
you could also run it as

bash -x scriptname
0
 
LVL 40

Expert Comment

by:omarfarid
Comment Utility
Also, you may put

#!/usr/bin/bash
set -x

at the script beginning
0
 
LVL 3

Author Closing Comment

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

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article will explain how to establish a SSH connection to Ubuntu through the firewall and using a different port other then 22. I have set up a Ubuntu virtual machine in Virtualbox and I am running a Windows 7 workstation. From the Ubuntu vi…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

762 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

10 Experts available now in Live!

Get 1:1 Help Now